https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117364
--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Eric Botcazou from comment #2) > > This does not seem morally different from NVRO. > > Yes, that's perfectly fine. > > > At present, I do not have a handle on where the actual issue is - since > > Rainer's and Eric's reports are from completely different phases in the > > lowering. > > Either we should stop Early SRA from doing the transformation (and I agree > that this could also happen out of the regular NRVO) or we should enhance > the RTL expander to deal with this (questionable IMO) construct. Apologies for being slow here - which, specific, construct are you considering questionable? and is there anything that the FE can do to make this better - without losing the copy-elision guarantee? (we are stuck with the basic sequence as described, it is mandated by the standard - so if that's the fundamental issue, we'd need to figure out a way to meeting the copy-elision criteria at the same time)