From fbc18a270f8d59219c5718eb37bef5a46d8cf301 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Thu, 26 Jan 2017 22:14:00 -0500 Subject: [PATCH] Bug 511108 - Do not attempt to resolve the name in an EvalID if the name owner is still dependent Change-Id: I63dcfa4413569554f30be0c6a94c2b1691515aa4 --- .../parser/tests/ast2/AST2TemplateTests.java | 38 ++++++++++++++++++- .../core/dom/parser/cpp/semantics/EvalID.java | 8 +++- 2 files changed, 43 insertions(+), 3 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 e25d2a2728c..2e568724fa3 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 @@ -10050,7 +10050,43 @@ public class AST2TemplateTests extends AST2TestBase { // MyContainer c; // reverse(c); // Ambiguous // } - public void testWaldo_510834() throws Exception { + public void testSFINAEInEvalIdWithFieldOwner_510834() throws Exception { + parseAndCheckBindings(); + } + + // template + // struct is_same { + // static constexpr bool value = false; + // }; + // + // template + // struct is_same { + // static constexpr bool value = true; + // }; + // + // template + // struct enable_if {}; + // + // template + // struct enable_if { + // typedef R type; + // }; + // + // template + // struct arg {}; + // + // template + // struct param { + // template + // param(arg::value, int>::type>&) {} + // }; + // + // void foo(param); + // + // void bar(arg& x) { + // foo(x); + // } + public void testInstantiationOfEvalIdWithFieldOwner_511108() throws Exception { parseAndCheckBindings(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java index fcba09d2a6a..d951083e52e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java @@ -369,15 +369,19 @@ public class EvalID extends CPPDependentEvaluation { if (templateArgs == fTemplateArgs && fieldOwner == fFieldOwner && nameOwner == fNameOwner) return this; + boolean nameOwnerStillDependent = false; if (nameOwner instanceof ICPPClassType) { ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, null, templateArgs, null, context.getPoint()); if (eval != null) return eval; - if (!CPPTemplates.isDependentType((ICPPClassType) nameOwner)) + if (CPPTemplates.isDependentType((ICPPClassType) nameOwner)) { + nameOwnerStillDependent = true; + } else { return EvalFixed.INCOMPLETE; + } } - if (fieldOwner != null && !fieldOwner.isTypeDependent()) { + if (!nameOwnerStillDependent && fieldOwner != null && !fieldOwner.isTypeDependent()) { IType fieldOwnerType = fieldOwner.getType(context.getPoint()); if (fIsPointerDeref) { fieldOwnerType = SemanticUtil.getSimplifiedType(fieldOwnerType);