https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91217
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2019-07-22 Target Milestone|--- |8.4 Summary|Returning std::array from |[8/9/10 Regression] |lambda results in an extra |Returning std::array from |copy step on return |lambda results in an extra | |copy step on return Ever confirmed|0 |1 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- I can confirm that with -O2 and GCC 8 there is hello_1 () { .. <bb 5> [local count: 12777528]: return <retval>; } while hello_2 () { ... <bb 5> [local count: 1073741826]: <retval>.m_data = ret; ret ={v} {CLOBBER}; return <retval>; } with GCC 9 TestB::TestB isn't inlined in addition (-O3 helps for that but not the other issue). GCC 7 manages to produce the code as hello_1 in both cases.