================
@@ -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);
+
----------------
zygoloid wrote:

Yeah, it's weird, but that's just how C++ is: converting a null pointer 
constant to pointer type is a completely different operation from 
reinterpreting an integer value (that happens to be 0) as a pointer value.

Similar weirdness would happen in C for this target:
```c
private int *p = (private int*)0; // null pointer.
intptr_t n = 0;
private int *q = (private int*)n; // not a null pointer.
intptr_t m = -1;
private int *r = (private int*)m; // null pointer.
```

https://github.com/llvm/llvm-project/pull/150164
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to