1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

Bug 252108.

This commit is contained in:
Sergey Prigogin 2008-10-26 22:44:29 +00:00
parent 253cc606d6
commit 6f602ad621
2 changed files with 30 additions and 0 deletions

View file

@ -3212,4 +3212,27 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPVariable b= ba.assertNonProblem("b =", 1, ICPPVariable.class);
ICPPFunction func= ba.assertNonProblem("func(cb)", 4, ICPPFunction.class);
}
// class Incomplete;
//
// char probe(Incomplete* p);
// char (&probe(...))[2];
//
// namespace ns1 {
//
// template<bool VAL>
// class A {
// public:
// static bool m(int a) {}
// };
// }
//
// void test() {
// int x;
// ns1::A<(sizeof(probe(x)) == 1)>::m(x);
// }
public void testNonTypeTemplateParameter_252108() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
ba.assertNonProblem("x))", 1, ICPPVariable.class);
}
}

View file

@ -840,6 +840,13 @@ public class CPPVisitor {
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames();
return getContainingScope(ns[ns.length - 1]);
}
} else if (parent instanceof ICPPASTTemplateId &&
node.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT) {
node= parent; // template-id
while (node instanceof IASTName) {
node= node.getParent();
}
continue;
}
} else if (node instanceof ICPPASTTemplateParameter) {
return CPPTemplates.getContainingScope(node);