summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-12-17 22:06:12 (EST)
committer Sergey Prigogin2013-12-17 23:29:05 (EST)
commitd9c458425762b92d80c01aa450e416bd217a174b (patch)
treef032ac7b4c60751ee4eea242ccfc56cbc439fb72
parentbb6d85dbd0c98ac8d9115fc785246cd1ade29be5 (diff)
downloadorg.eclipse.cdt-d9c458425762b92d80c01aa450e416bd217a174b.zip
org.eclipse.cdt-d9c458425762b92d80c01aa450e416bd217a174b.tar.gz
org.eclipse.cdt-d9c458425762b92d80c01aa450e416bd217a174b.tar.bz2
Bug 395074 - NPE in EvalFixed.<init>refs/changes/32/19932/3
Change-Id: I2457557add26e0121bd974fcc954ed879a8e8cf4 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/19932 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java18
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java3
2 files changed, 20 insertions, 1 deletions
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 e4dc436..1961359 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
@@ -7741,6 +7741,24 @@ public class AST2TemplateTests extends AST2TestBase {
BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true);
helper.assertProblem("bind(s, 0, foo)", "bind");
}
+
+ // struct a3 {
+ // int xxx;
+ // };
+ //
+ // template <template <typename> class V>
+ // struct S {};
+ //
+ // template <typename V>
+ // int foo(...);
+ //
+ // template <typename V>
+ // int foo(void*, S<V::template xxx>* = 0);
+ //
+ // int value = sizeof(foo<a3>(0));
+ public void testNPE_395074() throws Exception {
+ parseAndCheckBindings();
+ }
// template<typename T>
// T forward(T);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
index b88c50b..ffee46b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
@@ -264,7 +264,8 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
return ((IEnumerator) fMember).getValue();
}
if (fMember instanceof IVariable) {
- return ((IVariable) fMember).getInitialValue();
+ IValue initialValue = ((IVariable) fMember).getInitialValue();
+ return initialValue == null ? Value.UNKNOWN : initialValue;
}
if (fMember instanceof IFunction) {
return Value.UNKNOWN;