Community
Participate
Working Groups
Tested with 8.0.0, 8.0.1 and master. From bug 364188. template <class T> class TypeA{}; class TypeB{}; template <class T> T * func() { return 0; } int main() { delete func<TypeA <TypeB> >(); // This line causes the NPE } If the expression is instead : delete func<TypeB>(); then there is no NPE java.lang.NullPointerException at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.qualifiedName(GNUCPPSourceParser.java:291) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.primaryExpression(GNUCPPSourceParser.java:1693) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.postfixExpression(GNUCPPSourceParser.java:1496) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.unaryExpression(GNUCPPSourceParser.java:1316) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.castExpression(AbstractGNUSourceCodeParser.java:1264) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.deleteExpression(GNUCPPSourceParser.java:1090) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.unaryExpression(GNUCPPSourceParser.java:1263) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.castExpression(AbstractGNUSourceCodeParser.java:1264) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.castExpressionForBinaryExpression(GNUCPPSourceParser.java:1016) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.expression(GNUCPPSourceParser.java:766) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.expression(GNUCPPSourceParser.java:737) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parseDeclarationOrExpressionStatement(AbstractGNUSourceCodeParser.java:1851) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.statement(GNUCPPSourceParser.java:4309) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.compoundStatement(AbstractGNUSourceCodeParser.java:855) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.functionBody(AbstractGNUSourceCodeParser.java:1452) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.functionBody(GNUCPPSourceParser.java:4522) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.handleFunctionBody(AbstractGNUSourceCodeParser.java:1441) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.functionDefinition(GNUCPPSourceParser.java:2490) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.simpleDeclaration(GNUCPPSourceParser.java:2400) at org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser.declaration(GNUCPPSourceParser.java:2236) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.declarationList(AbstractGNUSourceCodeParser.java:1345) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parseTranslationUnit(AbstractGNUSourceCodeParser.java:1283) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.translationUnit(AbstractGNUSourceCodeParser.java:1278) at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parse(AbstractGNUSourceCodeParser.java:650) at org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage.getASTTranslationUnit(AbstractCLikeLanguage.java:148) at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(TranslationUnit.java:809) at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(TranslationUnit.java:768) at org.eclipse.cdt.internal.core.model.ASTCache$1.run(ASTCache.java:342) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.cdt.internal.core.model.ASTCache.createAST(ASTCache.java:336) at org.eclipse.cdt.internal.core.model.ASTCache.getAST(ASTCache.java:170) at org.eclipse.cdt.internal.core.model.ASTCache.acquireSharedAST(ASTCache.java:256) at org.eclipse.cdt.internal.core.model.ASTCache.runOnAST(ASTCache.java:217) at org.eclipse.cdt.internal.ui.editor.ASTProvider.runOnAST(ASTProvider.java:347) at org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:168) at org.eclipse.cdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:142) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Added testcase and fix.
*** cdt git genie on behalf of Markus Schorn *** Bug 364225: NPE in template ambiguity handling in delete expression. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=ad09f40af5ae2304f1030511e8b70b5f27946899
*** cdt git genie on behalf of Markus Schorn *** Bug 364225: NPE in template ambiguity handling in delete expression. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=bc6ff322dc0bf7d1e9a29b8cb791bc932dfc070c
Verified in 8.0.2 RC1.