1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 17:25:38 +02:00

Bug 516291 - If a function call has dependent arguments, resolve the function name as a CPPDeferredFunction even if there is only one viable candidate

This ensures that, when instantiating the function call, we get into
EvalFunctionSet.resolveFunction(), and check that the function is
actually callable with the instantiated argument types, and error out
if it isn't (which is important for SFINAE purposes).

Change-Id: Ia01755bc1a830fded1f61658f4beef875cc0b029
This commit is contained in:
Nathan Ridge 2017-05-08 02:09:01 -04:00
parent 9c0d9fec08
commit 9b809b0ad7
2 changed files with 19 additions and 4 deletions

View file

@ -3916,8 +3916,7 @@ public class AST2TemplateTests extends AST2TestBase {
bh.assertNonProblem("f(b)", 1, ICPPUnknownBinding.class, IFunction.class);
bh.assertNonProblem("h(b)", 1, ICPPUnknownBinding.class, IFunction.class);
bh.assertNonProblem("m(b)", 1, ICPPUnknownBinding.class, IFunction.class);
IFunction g= bh.assertNonProblem("g(b)", 1);
assertFalse(g instanceof ICPPUnknownBinding);
bh.assertNonProblem("g(b)", 1, ICPPUnknownBinding.class, IFunction.class);
}
// template<typename T> struct A {
@ -10112,6 +10111,24 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings();
}
// class C {};
//
// void aux(C);
//
// template<typename T>
// decltype(aux(T())) foo(T);
//
// int foo(...);
//
// void waldo(int);
//
// int main() {
// waldo(foo(0)); // Error here
// }
public void testSFINAEInDecltype_516291() throws Exception {
parseAndCheckBindings();
}
// template <typename, typename>
// struct is_same {
// static constexpr bool value = false;

View file

@ -2616,8 +2616,6 @@ public class CPPSemantics {
// Check for dependent arguments
fns= tmp;
if (CPPTemplates.containsDependentType(argTypes)) {
if (viableCount == 1)
return fns[0];
setTargetedFunctionsToUnknown(argTypes);
return CPPDeferredFunction.createForCandidates(fns);
}