[clang] [clang][bytecode] Diagnose failed constexpr assertions differently (PR #140000)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 02:10:57 PDT 2025


================
@@ -851,6 +851,19 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
   if (F->isLambdaStaticInvoker())
     return true;
 
+  // Diagnose failed assertions specially.
+  if (S.Current->getLocation(OpPC).isMacroID() &&
+      F->getDecl()->getIdentifier()) {
+    StringRef Name = F->getDecl()->getName();
+    bool AssertFailed =
+        Name == "__assert_rtn" || Name == "__assert_fail" || Name == "_wassert";
----------------
tbaederr wrote:

Link to what github issue?
I removed the fixme comment because it's already in `ExprConstant.cpp` and fixme comments like that don't tend to get fixed anyway.

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


More information about the cfe-commits mailing list