[clang] [clang][ExprConst] Consider integer pointers of value 0 nullptr (PR #150164)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 4 05:06:55 PDT 2025


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/150164 at github.com>


tbaederr wrote:

Is there a trick I'm missing?
I _can_ do this:
```c++
private int *p = 0;
private int *q = fold(reinterpret_cast<private int*>(0));
```

But this won't work:
```c++
template<const int*> void f() {}
template void f<fold(reinterpret_cast<private int*>(0))>();
```
```console
array.cpp:95:15: error: explicit instantiation of 'f' does not refer to a function template, variable template, member function, member class, or static data member
   95 | template void f<fold(reinterpret_cast<private int*>(0))>();
      |               ^
array.cpp:94:27: note: candidate template ignored: invalid explicitly-specified argument for 1st template parameter
   94 | template<const int*> void f() {}
      |                           ^
```
so I'm not sure how to test the mangling here.

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


More information about the cfe-commits mailing list