mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +02:00
Bug 252108.
This commit is contained in:
parent
253cc606d6
commit
6f602ad621
2 changed files with 30 additions and 0 deletions
|
@ -3212,4 +3212,27 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPVariable b= ba.assertNonProblem("b =", 1, ICPPVariable.class);
|
ICPPVariable b= ba.assertNonProblem("b =", 1, ICPPVariable.class);
|
||||||
ICPPFunction func= ba.assertNonProblem("func(cb)", 4, ICPPFunction.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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -840,6 +840,13 @@ public class CPPVisitor {
|
||||||
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames();
|
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames();
|
||||||
return getContainingScope(ns[ns.length - 1]);
|
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) {
|
} else if (node instanceof ICPPASTTemplateParameter) {
|
||||||
return CPPTemplates.getContainingScope(node);
|
return CPPTemplates.getContainingScope(node);
|
||||||
|
|
Loading…
Add table
Reference in a new issue