Community
Participate
Working Groups
The indexer (among others) encounter a NullPointerException on the code below. (cdt-2.0.1-I200408201009). template <class T> int add(T * x, T * y) { return x->value + y->value; }; Thread [C/C++ Indexer] (Suspended (exception NullPointerException)) CompleteParseASTFactory.usualArithmeticConversions(IASTScope, ITypeInfo, ITypeInfo) line: 1360 CompleteParseASTFactory.getExpressionResultType(IASTScope, IASTExpression$Kind, IASTExpression, IASTExpression, IASTExpression, IASTTypeId, char[], ISymbol) line: 1731 CompleteParseASTFactory.createExpression(IASTScope, IASTExpression$Kind, IASTExpression, IASTExpression, IASTExpression, IASTTypeId, ITokenDuple, char[], IASTExpression$IASTNewExpressionDescriptor) line: 1100 CompleteParser(ExpressionParser).additiveExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1362 CompleteParser(ExpressionParser).shiftExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1311 CompleteParser(ExpressionParser).relationalExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1238 CompleteParser(ExpressionParser).equalityExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1196 CompleteParser(ExpressionParser).andExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1144 CompleteParser(ExpressionParser).exclusiveOrExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1111 CompleteParser(ExpressionParser).inclusiveOrExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1078 CompleteParser(ExpressionParser).logicalAndExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1045 CompleteParser(ExpressionParser).logicalOrExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 1013 CompleteParser(ExpressionParser).conditionalExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 979 CompleteParser(ExpressionParser).assignmentExpression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 881 CompleteParser(ExpressionParser).expression(IASTScope, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 840 CompleteParser(Parser).statement(IASTCodeScope) line: 3150 CompleteParser(Parser).compoundStatement(IASTScope, boolean) line: 3333 CompleteParser(Parser).functionBody(IASTScope) line: 3027 CompleteParser.handleFunctionBody(IASTScope) line: 45 CompleteParser(Parser).simpleDeclaration(SimpleDeclarationStrategy, IASTScope, IASTTemplate, IASTCompletionNode$CompletionKind, boolean, KeywordSetKey) line: 1292 CompleteParser(Parser).simpleDeclarationStrategyUnion(IASTScope, IASTTemplate, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 924 CompleteParser(Parser).declaration(IASTScope, IASTTemplate, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 900 CompleteParser(Parser).templateDeclaration(IASTScope) line: 616 CompleteParser(Parser).declaration(IASTScope, IASTTemplate, IASTCompletionNode$CompletionKind, KeywordSetKey) line: 891 CompleteParser(Parser).translationUnit() line: 187 CompleteParser(Parser).parse() line: 140 SourceIndexer.indexFile(IDocument) line: 128 SourceIndexer(AbstractIndexer).index(IDocument, IIndexerOutput) line: 500 Index.add(IDocument, IIndexer) line: 110 AddCompilationUnitToIndex.indexDocument(IIndex) line: 29 AddCompilationUnitToIndex(AddFileToIndex).execute(IProgressMonitor) line: 55 IndexManager(JobManager).run() line: 471 Thread.run() line: 534
Andrew, please look into this today if you can. If it cannot be fixed, pls provide a workaround.
The best I will be able to do for this in 2.0.1 is to avoid the null pointer. Successfully parsing this will be harder, this is the same problem as 60307.
the NPE has been fixed in 2.0.1, it appears to have been fixed in the head at some other time. I'm dropping the severity/priority and leaving this open so I something regarding template parameters in expressions to go along with 60307.
Andrew, pls close this defect and raise another shadow defect if required. Thanks
I ammend my piratical ways and return the highjacked defect.