https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101442
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Reduced: bool destroyed = false; struct A { A() {} A(const A &) = delete; A &operator=(const A &) = delete; ~A() {destroyed = true;} }; struct B { const A &a; struct string { string(const char*) { } ~string() { } } s; }; B foo() { B ret{ A{}, "" }; return ret; } int main() { { B b = foo(); } if (!destroyed) __builtin_abort(); }