https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109945
--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the C version is UB, it escapes address of a local variable. The C++ case is different when the language mandates NVR, in that case one can rely on it. TREE_ADDRESSABLE on a type is I think set consistently on a type, it means the type has non-trivial copy constructor or destructor, so can't be copied implicitly. Widget can be copied implicitly in C++, but with mandatory NRV user can rely on the return value still being in scope when global is dereferenced.