mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Bug 508254 - Instantiation of id-expression naming static field
Change-Id: I97732a3f1ceba560e762e5f61c68a052ebceb7b5
This commit is contained in:
parent
7f9171cd74
commit
94734f0fd1
2 changed files with 27 additions and 0 deletions
|
@ -3457,6 +3457,29 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP);
|
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP);
|
||||||
ICPPTemplateTypeParameter t= ba.assertNonProblem("T)", 1, ICPPTemplateTypeParameter.class);
|
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>
|
// template<class T1, T1 v1>
|
||||||
// struct integral_constant {
|
// struct integral_constant {
|
||||||
|
|
|
@ -439,6 +439,10 @@ public class EvalID extends CPPDependentEvaluation {
|
||||||
return new EvalBinding(binding, null, getTemplateDefinition());
|
return new EvalBinding(binding, null, getTemplateDefinition());
|
||||||
}
|
}
|
||||||
if (binding instanceof ICPPMember) {
|
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) {
|
if (ownerEval != null) {
|
||||||
return new EvalMemberAccess(nameOwner, ownerEval.getValueCategory(point), binding, ownerEval, false, point);
|
return new EvalMemberAccess(nameOwner, ownerEval.getValueCategory(point), binding, ownerEval, false, point);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue