https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102899
Bug ID: 102899 Summary: Performing `delete this` within destructor in constant evaluation results in infinitely recursive error message Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: friedkeenan at protonmail dot com Target Milestone: --- See the following code: struct Test { constexpr Test() = default; constexpr ~Test() { delete this; } }; consteval bool test() { const auto obj = Test{}; return true; } static_assert(test()); Godbolt link: https://godbolt.org/z/fv3dGWsY1 This bug still occurs when `obj` is heap-allocated and destroyed with `std::destroy_at`. This issue does not occur if the `delete this` statement is relegated to another method, including the constructor; it only occurs when `delete this` is placed within the destructor.