[clang] Disable constexpr function body checking in more situations (PR #94347)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 06:36:31 PDT 2024


================
@@ -505,6 +505,9 @@ COMPATIBLE_LANGOPT(IncrementalExtensions, 1, 0, " True if we want to process sta
 
 BENIGN_LANGOPT(CheckNew, 1, 0, "Do not assume C++ operator new may not return NULL")
 
+BENIGN_LANGOPT(CheckConstexprFunctionBodies, 1, 1,
+               "True if we want to emit a diagnostics for a constexpr function "
----------------
erichkeane wrote:

```suggestion
               "Emit diagnostics for a constexpr function body that can never be used in a constant expression."
```

Also: I think this is hacky and unfortunate that we're using a bit in `LangOpts` to control a warning's state, which feels kind of dangerous.  I'd love a `FIXME` above this that proposes 1 of 2 ideas: Either find a way for Diagnostics TableGen to be language mode specific, or find a way to put this into CompilerInvocatoin in a way that survives argument rewriting.

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


More information about the cfe-commits mailing list