[libcxx-commits] [clang] [libcxx] [Clang] Diagnose forming references to nullptr (PR #143667)

Corentin Jabot via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 10 04:52:05 PDT 2025


================
@@ -265,7 +265,7 @@ namespace const_modify {
 
 namespace null {
   constexpr int test(int *p) {
-    return *p = 123; // expected-note {{assignment to dereferenced null pointer}}
+    return *p = 123; // expected-note {{read of dereferenced null pointer}}
----------------
cor3ntin wrote:

I think we can either
  - say something like "access to dereferenced null pointer"
  - introduce a different diagnostic for this case, so we can just say "dereferencing null pointer"

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


More information about the libcxx-commits mailing list