https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84414
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- To me, the temp object A inside Foo ends its scope at the end function (even with guaranteed copy elision). Because this would mean the compiler will have to assume nothing about any structs that are returned which seems backwards and even counter to the language itself. Maybe it is time to file a DR to the C++ language folks about this case if there is not one already. Where does the scope of object A inside Foo begin and end?