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

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 27 15:18:17 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:

Looking at this again, leaving this line would break this test case:

```C++
template<int N> void g(const char (*)[([]{ return N; })()]) {}
template<int N> void g(const char (*)[([]{ return N; })()]) {}
void use_g() { g<6>(&"hello"); }
```

On the partial ordering case, N stays dependent, so we hit here.
This function assumes that, in certain evaluation modes, this expression has to contain an error.
But I don't see how that assumption holds true from the surrounding code.

CC @hokein since he implemented this originally, and was the last one to touch this code.

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


More information about the cfe-commits mailing list