https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96721
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- build_trivial_dtor_call has: if (INDIRECT_TYPE_P (TREE_TYPE (instance))) { if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (instance)))) goto no_clobber; instance = cp_build_fold_indirect_ref (instance); } so, either we adjust the caller such that for TYPE_PTR_P types it passes an address of the instance rather than the instance itself, or we add an argument (perhaps defaulted bool) to build_trivial_dtor_call that inhibits this behavior for TYPE_PTR_P, or drop this if completely and adjust any caller that calls it with a pointer or reference and expects it to destruct what it points to rather than itself.