1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 401743 - NullPointerException in EvalBinding.instantiate() - tpMap

is null

Change-Id: Ie33a99c582adccb44152033ca29ba0b88b5823ad
Reviewed-on: https://git.eclipse.org/r/10805
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2013-03-03 04:46:27 -05:00 committed by Sergey Prigogin
parent 664da44695
commit ec7a25ee6d
2 changed files with 72 additions and 3 deletions

View file

@ -7364,4 +7364,71 @@ public class AST2TemplateTests extends AST2TestBase {
assertNotNull(barValue);
assertEquals(2, barValue.longValue());
}
// template <int...> struct tuple_indices {};
// template <int Sp, class IntTuple, int Ep>
// struct make_indices_imp;
// template <int Sp, int ...Indices, int Ep>
// struct make_indices_imp<Sp, tuple_indices<Indices...>, Ep> {
// typedef typename make_indices_imp<Sp + 1, tuple_indices<Indices..., Sp>, Ep>::type type;
// };
// template <int Ep, int ...Indices>
// struct make_indices_imp<Ep, tuple_indices<Indices...>, Ep> {
// typedef tuple_indices<Indices...> type;
// };
// template <int Ep, int Sp = 0>
// struct make_tuple_indices {
// typedef typename make_indices_imp<Sp, tuple_indices<>, Ep>::type type;
// };
// template <class ... Args>
// class async_func {
// void operator()() {
// typedef typename make_tuple_indices<1 + sizeof...(Args), 1>::type Index;
// }
// };
public void testVariadicTemplatesNPE_401743() throws Exception {
parseAndCheckBindings();
}
// template <typename T>
// struct A {};
//
// template <typename T>
// struct B {
// typedef int type;
// };
//
// template <class T, const T& V>
// struct C {};
//
// extern const char* const K = "";
//
// typedef A<C<const char*, K>> D;
//
// typedef B<D>::type E; // Problem on B<D>::type
public void testRegression_401743a() throws Exception {
parseAndCheckBindings();
}
// template <typename T>
// struct A {};
//
// template <typename T>
// struct B {
// typedef int type;
// };
//
// template <class T, const T& V>
// struct C {};
//
// class F {};
//
// extern F K;
//
// typedef A<C<F, K>> D;
//
// typedef B<D>::type E; // Problem on B<D>::type
public void testRegression_401743b() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -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;