1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Bug 516291 - Improve propagattion of instantiate failures through EvalFunctionCall and EvalComma

Change-Id: Ieafe15a88c3838d15aaaf9043199ae2caf1c31db
This commit is contained in:
Nathan Ridge 2017-05-08 02:59:52 -04:00
parent 9b809b0ad7
commit 882f8e95a9
3 changed files with 28 additions and 1 deletions

View file

@ -10125,7 +10125,25 @@ public class AST2TemplateTests extends AST2TestBase {
// int main() {
// waldo(foo(0)); // Error here
// }
public void testSFINAEInDecltype_516291() throws Exception {
public void testSFINAEInDecltype_516291a() throws Exception {
parseAndCheckBindings();
}
// class C {};
//
// void aux(C);
//
// template<typename T>
// decltype(aux(T()), C()) foo(T);
//
// int foo(...);
//
// void waldo(int);
//
// int main() {
// waldo(foo(0)); // Error here
// }
public void testSFINAEInDecltype_516291b() throws Exception {
parseAndCheckBindings();
}

View file

@ -199,6 +199,10 @@ public class EvalComma extends CPPDependentEvaluation {
for (int i = 0; i < fArguments.length; i++) {
ICPPEvaluation arg = fArguments[i].instantiate(context, maxDepth);
if (arg != fArguments[i]) {
// Propagate instantiation errors for SFINAE purposes.
if (arg == EvalFixed.INCOMPLETE) {
return arg;
}
if (args == fArguments) {
args = new ICPPEvaluation[fArguments.length];
System.arraycopy(fArguments, 0, args, 0, fArguments.length);

View file

@ -224,6 +224,11 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
// Resolve the function using the parameters of the function call.
EvalFunctionSet functionSet = (EvalFunctionSet) args[0];
args[0] = functionSet.resolveFunction(Arrays.copyOfRange(args, 1, args.length), context.getPoint());
// Propagate instantiation errors for SFINAE purposes.
if (args[0] == EvalFixed.INCOMPLETE) {
return args[0];
}
}
ICPPEvaluation newImplicitThis = fImplicitThis != null ? fImplicitThis.instantiate(context, maxDepth) : null;