[clang] [clang][Sema] Guard diagnose_if value-dependent conditions (PR #197647)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 09:54:41 PDT 2026


================
@@ -7801,8 +7801,12 @@ bool Sema::diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
         // It's sane to use the same Args for any redecl of this function, since
         // EvaluateWithSubstitution only cares about the position of each
         // argument in the arg list, not the ParmVarDecl* it maps to.
-        if (!DIA->getCond()->EvaluateWithSubstitution(
-                Result, Context, cast<FunctionDecl>(DIA->getParent()), Args, ThisArg))
+        // FIXME: This doesn't consider value-dependent cases, because doing so
+        // is very difficult. Ideally, we should handle them more gracefully.
+        if (DIA->getCond()->isValueDependent() ||
----------------
mizvekov wrote:

As far as I remember from what I have seen, the `-ferror-limit` stuff just suppresses further diagnostics, but it doesn't change anything about error recovery.

We do alter error recovery behavior based out of being in an SFINAE context though.

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


More information about the cfe-commits mailing list