https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106965
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- I think it's undefined to invoke a DTOR twice which is what you do here. After the DTOR the m_ptr member becomes undefined so re-evaluating that in the second invocation (when there's no object of type X anymore) is undefined.