https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120409
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |16.0
--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Iain Sandoe from comment #5)
> well .. the visible difference in gimple, but this is code outside of the
> coroutines changes (i.e. just a bit of regular C++).
>
> However, it does seem we create the return object correctly .. and then
> return an empty one. We seem to be failing to do copy elision.
>
On x32, OptionalPromiseReturn is 16 bytes, which is returned in 2 registers.
You can't assume that copy elision will happen. You need to prepare for it.