mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 508254 - Instantiation of id-expression naming static field
Change-Id: I97732a3f1ceba560e762e5f61c68a052ebceb7b5
This commit is contained in:
parent
e9c3f978a8
commit
a93b94b822
2 changed files with 27 additions and 0 deletions
|
@ -3457,6 +3457,29 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP);
|
||||
ICPPTemplateTypeParameter t= ba.assertNonProblem("T)", 1, ICPPTemplateTypeParameter.class);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// constexpr T id(T a) {
|
||||
// return a;
|
||||
// }
|
||||
//
|
||||
// template <int N>
|
||||
// struct ratio {
|
||||
// static const int num = N;
|
||||
// };
|
||||
//
|
||||
// template <typename factor>
|
||||
// struct ratioRoundUp : ratio<id(factor::num)> {};
|
||||
//
|
||||
// typedef ratioRoundUp<ratio<42>> rounded;
|
||||
//
|
||||
// template <int> struct Waldo;
|
||||
// template <> struct Waldo<42> { typedef int type; };
|
||||
//
|
||||
// Waldo<rounded::num>::type foo(); // ERROR
|
||||
public void testDependentIdExprNamingStaticMember_508254() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template<class T1, T1 v1>
|
||||
// struct integral_constant {
|
||||
|
|
|
@ -439,6 +439,10 @@ public class EvalID extends CPPDependentEvaluation {
|
|||
return new EvalBinding(binding, null, getTemplateDefinition());
|
||||
}
|
||||
if (binding instanceof ICPPMember) {
|
||||
if (((ICPPMember) binding).isStatic()) {
|
||||
// Don't use EvalMemberAccess to represent accesses of static members.
|
||||
return new EvalBinding(binding, null, getTemplateDefinition());
|
||||
}
|
||||
if (ownerEval != null) {
|
||||
return new EvalMemberAccess(nameOwner, ownerEval.getValueCategory(point), binding, ownerEval, false, point);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue