[Bug c++/102284] Can access object outside of its lifetime during constant evaluation

johelegp at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Sep 10 21:23:04 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102284

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
There's also https://eel.is/c++draft/basic.life#9.sentence-1 to consider.
See https://godbolt.org/z/P97Kaqhv8.
```C++
struct X { int x; };
int main() {
  []() consteval {
    X x{};
    x.~X();
  }();
}
```


More information about the Gcc-bugs mailing list