From 83d0b2be3e17f6a01c551a28fbe759cfb995d2d1 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 9 Mar 2014 06:45:58 -0400 Subject: [PATCH] Bug 429928 - SFINAE when resolving address of function Change-Id: I2edb6becd4b79c7943e1e4b7c046afb25e398a31 Signed-off-by: Nathan Ridge Reviewed-on: https://git.eclipse.org/r/23090 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin --- .../parser/tests/ast2/AST2TemplateTests.java | 28 ++++++++++++++++++- .../parser/cpp/semantics/CPPSemantics.java | 7 ++++- 2 files changed, 33 insertions(+), 2 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 b60d2b353d7..be91211289e 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 @@ -7357,7 +7357,33 @@ public class AST2TemplateTests extends AST2TestBase { public void testSFINAEInTemplatedConversionOperator_409056() throws Exception { parseAndCheckImplicitNameBindings(); } - + + // template + // struct A { + // static constexpr bool value = false; + // }; + // + // template + // struct enable_if {}; + // + // template + // struct enable_if { + // typedef T type; + // }; + // + // template + // void + // waldo(); + // + // template + // typename enable_if::value>::type + // waldo(); + // + // auto x = waldo; // problem on valdo + public void testSfinaeWhenResolvingAddressOfFunction_429928() 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/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java index f87f6863ec2..1c3bf1b8a2a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java @@ -2578,7 +2578,12 @@ public class CPPSemantics { ICPPFunctionTemplate funcTemp = (ICPPFunctionTemplate) f; final ICPPTemplateParameter[] tpars = funcTemp.getTemplateParameters(); final CPPTemplateParameterMap map = new CPPTemplateParameterMap(tpars.length); - isCandidate= TemplateArgumentDeduction.addExplicitArguments(funcTemp, tpars, args, map, point); + if (!TemplateArgumentDeduction.addExplicitArguments(funcTemp, tpars, args, map, point)) { + isCandidate= false; + } else { + f = CPPTemplates.instantiateForAddressOfFunction(funcTemp, null, args, point); + isCandidate= f != null; + } } } else { isCandidate= args == null;