https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119699
Christophe Lyon <clyon at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clyon at gcc dot gnu.org --- Comment #2 from Christophe Lyon <clyon at gcc dot gnu.org> --- FTR I tried this based on your suggestion: diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index a785d5e79cb..a709bde8f15 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -18945,6 +18945,7 @@ maybe_prepare_return_this (tree cdtor) if (targetm.cxx.cdtor_returns_this ()) if (tree val = DECL_ARGUMENTS (cdtor)) { + set_call_expr_flags (cdtor, ECF_RET1); suppress_warning (val, OPT_Wuse_after_free); return val; } but it had no effect on codegen.