1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

NPE resolving template-id in using-decl, bug 251199.

This commit is contained in:
Markus Schorn 2008-10-17 13:10:37 +00:00
parent f9a7cd90e1
commit 129297342f
2 changed files with 16 additions and 4 deletions

View file

@ -6135,6 +6135,14 @@ public class AST2CPPTests extends AST2BaseTest {
} }
} }
// namespace ns {
// template<typename T> class CT {};
// }
// using ns::CT<int>;
public void testTemplateIDInUsingDecl_251199() throws Exception {
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
}
// void f(); // void f();
// //
// void test(int p) { // void test(int p) {

View file

@ -470,10 +470,14 @@ public class CPPTemplates {
parent = parent.getParent(); parent = parent.getParent();
} }
IASTNode decl = parent.getParent(); IASTNode decl= parent;
while (!(decl instanceof IASTDeclaration)) while (decl != null) {
decl = decl.getParent(); if (decl instanceof IASTDeclaration) {
decl = decl.getParent(); decl= decl.getParent();
break;
}
decl= decl.getParent();
}
try { try {
if (decl instanceof ICPPASTExplicitTemplateInstantiation && if (decl instanceof ICPPASTExplicitTemplateInstantiation &&