[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 26 20:01:58 PDT 2024


================
@@ -5346,7 +5346,6 @@ static EvalStmtResult EvaluateStmt(StmtResult &Result, EvalInfo &Info,
     const Expr *RetExpr = cast<ReturnStmt>(S)->getRetValue();
     FullExpressionRAII Scope(Info);
     if (RetExpr && RetExpr->isValueDependent()) {
-      EvaluateDependentExpr(RetExpr, Info);
----------------
mizvekov wrote:

I see. The problem is that in this case we can have incomplete substitutions. For most of the template instantiator, this is not a problem since rebuilding into any dependent stuff just suppresses further analysis, and we just discard the result of the substitution since it was incomplete anyway.

This breaks down here because of the lambda, since a call to an incompletely substituted lambda can come off as non-dependent, even though you would find dependent stuff if you tried to evaluate it.

If the constant expression evaluator would treat finding any dependent stuff as an error, this would come off ok. But since you pointed out there would need to be more places to fix, I think what we could do instead is just bail out immediately when  we know we have an incomplete substitution.



https://github.com/llvm/llvm-project/pull/100692


More information about the cfe-commits mailing list