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

JJ Marr via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 16:25:13 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";
----------------
jj-marr wrote:

I actually want to fix it at some point since I wrote the original code. My skillset is bad though which is why I couldn't figure it out. I'll make the GitHub issue and assign it to myself. 

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


More information about the cfe-commits mailing list