| Issue |
165952
|
| Summary |
[clang][bytecode] addressof is not constexpr
|
| Labels |
clang:bytecode
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/7j8YTGGM9
```cpp
template <typename T> constexpr inline T *addressof(T &x) noexcept {
return __builtin_addressof(x);
}
struct T {
static T tt;
constexpr T() : p(addressof(tt)) {}
constexpr T *operator&() const { return p; }
T *p;
};
constexpr T t;
T T::tt;
static_assert(&t == __builtin_addressof(T::tt), "");
static_assert(&t == addressof(T::tt), "");
```
When the above program is compiled with option `-fexperimental-new-constant-interpreter` enabled, it fails. When the option is disabled, it succeeds as expected.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs