[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:24:07 GMT 2021


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

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Fixed that: https://godbolt.org/z/YGf4GTP5P.
```C++
struct X { constexpr ~X() { } };
int main() {
  []() consteval {
    X x{};
    x.~X();
  }();
}
```


More information about the Gcc-bugs mailing list