https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58487
Antony Polukhin <antoshkka at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |antoshkka at gmail dot com --- Comment #3 from Antony Polukhin <antoshkka at gmail dot com> --- Minimized example, move constructor should not be called: struct A { A() = default; A(A&&); }; A test() { if (true) { A a; return a; } else { return A{}; } } Godbolt playground: https://godbolt.org/z/4Pzq83WWY