https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116346
Bug ID: 116346 Summary: Bad __cxa_atexit location for extended init ref temporaries Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Consider struct B { B (); ~B (); }; struct A { A (); ~A (); }; A foo (const B &, const B &); const A &x = foo (B {}, B {}); I see __cxa_atexit (__dt_comp , &_ZGR1x_, &__dso_handle); call before the first B::B() call, that looks wrong to me, shouldn't that be done right before the foo call or right after it? If B::B() throws, then _ZGR1x_ will not be constructed but will be destructed.