https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64142 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- C++17 changes the rules about elide-copies and actually forces to do it rather than just allowing it.