From e91e3669b7ff26bb2c75aca34ae82d81f0dfacbd Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 10 Mar 2014 20:55:28 -0700 Subject: [PATCH] Bug 429928 - False "invalid overload" due to undetected instantiation failure. Change-Id: I6f89baa929560468eb899255875865e29d254218 Reviewed-on: https://git.eclipse.org/r/23171 Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin --- .../parser/tests/ast2/AST2TemplateTests.java | 32 +++++++++++++++---- .../core/dom/parser/cpp/semantics/EvalID.java | 4 ++- 2 files changed, 29 insertions(+), 7 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 28e7e4c52bf..1d07da7e667 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 @@ -7372,18 +7372,38 @@ public class AST2TemplateTests extends AST2TestBase { // }; // // template - // void - // waldo(); + // void waldo(); // // template - // typename enable_if::value>::type - // waldo(); + // typename enable_if::value>::type waldo(); // - // auto x = waldo; // problem on valdo - public void testSfinaeWhenResolvingAddressOfFunction_429928() throws Exception { + // auto x = waldo; + public void testSfinaeWhenResolvingAddressOfFunction_429928a() throws Exception { parseAndCheckBindings(); } + // template + // struct A {}; + // + // template + // struct enable_if {}; + // + // template + // struct enable_if { + // typedef T type; + // }; + // + // template + // void waldo(); + // + // template + // typename enable_if::value>::type waldo(); + // + // auto x = waldo; + public void testSfinaeWhenResolvingAddressOfFunction_429928b() throws Exception { + parseAndCheckBindings(); + } + // template // struct M { // template 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 36ffb4a9c88..e25c89afc4d 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 @@ -324,7 +324,7 @@ public class EvalID extends CPPDependentEvaluation { if (!(type instanceof IBinding)) return EvalFixed.INCOMPLETE; - nameOwner = (IBinding)type; + nameOwner = (IBinding) type; } if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding) @@ -337,6 +337,8 @@ public class EvalID extends CPPDependentEvaluation { ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, templateArgs, null, point); if (eval != null) return eval; + if (!CPPTemplates.isDependentType((ICPPClassType) nameOwner)) + return EvalFixed.INCOMPLETE; } if (fieldOwner != null && !fieldOwner.isTypeDependent()) {