| Issue |
174177
|
| Summary |
`this` inside `consteval` is nullptr
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
szmarczak
|
https://godbolt.org/z/8EbPvE7zP
```cpp
#include <iostream>
consteval const auto & x() {
struct Y {
void * ptr = this;
};
static constexpr auto z = Y{};
return z;
}
int main(int argc, char* argv[]) noexcept {
static_cast<void>(argc);
static_cast<void>(argv);
std::cout << x().ptr << std::endl; // 0 in clang, 0x400838 on g++
return 0;
}
```
I'm not sure if this is off spec, however given it returns an address on g++, I believe this is a miscompilation?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs