Consider the example: struct Struct { Struct() = default; Struct(Struct&&); }; Struct question10(bool b) { if (b) { Struct s{}; return s; } else { return {}; } } It is possible to elide move constructor call as the lifetimes of object `s` and `return {}` do not intersect. (some other compilers already do copy elision in that place https://godbolt.org/z/wdpLkT )
This looks like a duplicate of PR53637 / PR53637.
Confirmed.
(In reply to Óscar Fuentes from comment #1) > This looks like a duplicate of PR53637 / PR53637. More 58487. *** This bug has been marked as a duplicate of bug 58487 ***