1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

bug 74847- [Parser] In ASTBaseSpecifier.getParentClassSpecifier, the "symbol" attribute is dereferenced to null

This commit is contained in:
Andrew Niefer 2004-10-08 15:36:15 +00:00
parent c29004f64c
commit 1b2f0d5e9e
2 changed files with 15 additions and 2 deletions

View file

@ -2263,5 +2263,17 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
assertTrue(ip.getArguments().indexOf("This was equal, but not for the eclipse") > 0);
}
}
public void testBug74847() throws Exception {
String code = "class A : public FOO {};";
Iterator i = parse( code, false ).getDeclarations();
IASTClassSpecifier A = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
assertFalse( A.getBaseClauses().hasNext() );
i = callback.getProblems();
IProblem problem = (IProblem) i.next();
assertEquals( problem.getID(), IProblem.SEMANTIC_NAME_NOT_FOUND );
assertEquals( problem.getSourceStart(), code.indexOf( "FOO" ) );
assertFalse( i.hasNext() );
}
}

View file

@ -915,8 +915,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
//Its possible that the parent is not an IContainerSymbol if its a template parameter or some kinds of template instances
ISymbol symbol = lookupQualifiedName( classSymbol, parentClassName, references, true );
if( symbol instanceof ITemplateSymbol &&
! ( symbol instanceof UndefinedTemplateSymbol ) )
if( symbol == null )
handleProblem( IProblem.SEMANTIC_NAME_NOT_FOUND, parentClassName.toCharArray(), parentClassName.getStartOffset(), parentClassName.getEndOffset(), parentClassName.getLineNumber(), true );
if( symbol instanceof ITemplateSymbol && ! ( symbol instanceof UndefinedTemplateSymbol ) )
handleProblem( IProblem.SEMANTIC_INVALID_TEMPLATE_ARGUMENT, parentClassName.toCharArray(), parentClassName.getStartOffset(), parentClassName.getEndOffset(), parentClassName.getLineNumber(), true);
List [] templateArgumentLists = parentClassName.getTemplateIdArgLists();