https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96721
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:61680cfaf1eef26a5953f36ab82a1cc13f9b2f2c commit r11-2831-g61680cfaf1eef26a5953f36ab82a1cc13f9b2f2c Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Aug 25 07:19:41 2020 +0200 c++: Fix up ptr.~PTR () handling [PR96721] The following testcase is miscompiled, because build_trivial_dtor_call handles the case when instance is a pointer by adding a clobber to what the pointer points to (which is desirable e.g. for delete) rather than the pointer itself. That is I think always desirable behavior for references, but for pointers for the pseudo dtor case it is not. 2020-08-25 Jakub Jelinek <ja...@redhat.com> PR c++/96721 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted to false. * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If instance is a pointer and NO_PTR_DEREF is true, clobber the pointer rather than what it points to. * semantics.c (finish_call_expr): Call build_trivial_dtor_call with true as NO_PTR_DEREF. * g++.dg/opt/flifetime-dse8.C: New test.