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

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 26 01:43:27 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);
----------------
hokein wrote:

If I recall correctly, historically (before the introduction of RecoveryExpr), we assumed that a non-template function never contained any value-dependent expressions. The constant expression evaluator relied on this assumption. However, with the introduction of RecoveryExpr (which is always value-dependent), we started encountering value-dependent expressions outside of dependent contexts.

We enhanced the constant evaluator to handle these value-dependent cases, but only specifically for RecoveryExpr. This code path should now only be triggered by RecoveryExpr, which is why we expect the containErrors bit in EvaluateDependentExpr.

The removal of EvaluateDependentExpr seems a bit suspicious to me, as we still call EvaluateDependentExpr in several other places.

With this change, are we starting to see value-dependent expressions that are not RecoveryExpr in the constant expression evaluator?

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


More information about the cfe-commits mailing list