https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111264
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-09-01 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Hans-Peter Nilsson from comment #1) > Also seen for cris-elf and m68k-linux > (https://gcc.gnu.org/pipermail/gcc-testresults/2023-August/794806.html). > > Some experimentation says that this is a mismatch between the default C++ > version for the host/installed gcc (for me, C++11, I think) and the target > (C++17, right?). If you add "-std=c++17" to the invocation line in gcc.log, > compilation succeeds. Or, change the form of the newly introduced > declarations from > auto foobar = foo<bar>(); > to > foo<bar> foobar; > Not sure why the former is used, it seems negate the benefits of auto and > just be more typing. Beware: since I know Very Little C++ of the last > decades, I could be completely wrong. You are mostly correct. In C++17, Copy elision is guaranteed to be done here while in earlier versions it is not and earlier versions of C++ require a copy/move constructor even if copy elision is to be done. See https://en.cppreference.com/w/cpp/language/copy_elision for more information.