https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95514
Paul Keir <pkeir at outlook dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Paul Keir <pkeir at outlook dot com> --- Here is a reduced test case which removes prior use of static_cast and a pointer reference parameter. struct FooBase { constexpr FooBase* get_this() { return this; } int x; }; struct Foo : FooBase {}; constexpr bool test() { Foo* pf = new Foo; delete pf->get_this(); return true; } constexpr bool b = test(); --- Comment #3 from Paul Keir <pkeir at outlook dot com> --- The code invokes undefined behaviour; as it tries to delete the object through pointer to base.