diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index a6fde67a74f..fb814126819 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -7364,4 +7364,71 @@ public class AST2TemplateTests extends AST2TestBase { assertNotNull(barValue); assertEquals(2, barValue.longValue()); } + + // template struct tuple_indices {}; + // template + // struct make_indices_imp; + // template + // struct make_indices_imp, Ep> { + // typedef typename make_indices_imp, Ep>::type type; + // }; + // template + // struct make_indices_imp, Ep> { + // typedef tuple_indices type; + // }; + // template + // struct make_tuple_indices { + // typedef typename make_indices_imp, Ep>::type type; + // }; + // template + // class async_func { + // void operator()() { + // typedef typename make_tuple_indices<1 + sizeof...(Args), 1>::type Index; + // } + // }; + public void testVariadicTemplatesNPE_401743() throws Exception { + parseAndCheckBindings(); + } + + // template + // struct A {}; + // + // template + // struct B { + // typedef int type; + // }; + // + // template + // struct C {}; + // + // extern const char* const K = ""; + // + // typedef A> D; + // + // typedef B::type E; // Problem on B::type + public void testRegression_401743a() throws Exception { + parseAndCheckBindings(); + } + + // template + // struct A {}; + // + // template + // struct B { + // typedef int type; + // }; + // + // template + // struct C {}; + // + // class F {}; + // + // extern F K; + // + // typedef A> D; + // + // typedef B::type E; // Problem on B::type + public void testRegression_401743b() throws Exception { + parseAndCheckBindings(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java index cd6b3f000fd..1283f94e966 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java @@ -336,9 +336,11 @@ public class EvalBinding extends CPPDependentEvaluation { ICPPClassSpecialization within, int maxdepth, IASTNode point) { IBinding origBinding = getBinding(); if (origBinding instanceof ICPPTemplateNonTypeParameter) { - ICPPTemplateArgument argument = tpMap.getArgument((ICPPTemplateNonTypeParameter) origBinding, packOffset); - if (argument != null && argument.isNonTypeValue()) { - return argument.getNonTypeEvaluation(); + if (tpMap != null) { + ICPPTemplateArgument argument = tpMap.getArgument((ICPPTemplateNonTypeParameter) origBinding, packOffset); + if (argument != null && argument.isNonTypeValue()) { + return argument.getNonTypeEvaluation(); + } } } else if (origBinding instanceof ICPPParameter) { ICPPParameter parameter = (ICPPParameter) origBinding;