[clang] [clang][ExprConst] Consider integer pointers of value 0 nullptr (PR #150164)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 24 00:18:54 PDT 2025
================
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple amdgcn -cl-std=clc++ -verify %s
+
+// expected-no-diagnostics
+
+#define fold(x) (__builtin_constant_p(x) ? (x) : (x))
+static_assert(nullptr != fold(reinterpret_cast<private int*>(0)));
+
+static_assert(nullptr == (private int *)0);
+
----------------
tbaederr wrote:
The fact that the two casts behave differently seems weird, but the second one is a `NullToPointer` cast.
https://github.com/llvm/llvm-project/pull/150164
More information about the cfe-commits
mailing list