[clang] [clang][bytecode] Diagnose non-block pointers in __builtin_is_within_lifetime (PR #228337)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 6 23:54:25 PDT 2026


================
@@ -2446,6 +2446,14 @@ static bool interp__builtin_is_within_lifetime(InterpState &S, CodePtr OpPC,
       return false;
   }
 
+  if (!Ptr.isBlockPointer()) {
+    S.FFDiag(S.Current->getSource(OpPC),
+             diag::note_constexpr_access_unreadable_object)
+        << AK_Read << Ptr.toDiagnosticString(S.getASTContext());
+    noteValueLocation(S, Ptr);
----------------
ojhunt wrote:

I would prefer it if you at least covered the `object ... whose value is not known`, but I won't block you on it.

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


More information about the cfe-commits mailing list