https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90204
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That would be likely NRV optimization in the C++ FE, but then why doesn't the generic NRV optimization handle it in the middle-end later on?