https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65869
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=80452, | |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=91427 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Some interesting history here: GCC7.5.0 and before accepted the code in C++11, C++14 and C++17 modes GCC8+ reject the code in C++11, C++14, and C++17 modes with the following error message: <source>: In function 'Derived foo()': <source>:14:10: error: cannot bind rvalue reference of type 'Base&&' to lvalue of type 'Base' return result; ^~~~~~ <source>:9:5: note: initializing argument 1 of 'Derived::Derived(Base&&)' Derived(Base&&); ^~~~~~~ GCC11+ started to accept the code in C++20 mode. GCC8 change was due to PR 80452. GCC11 in C++20 mode seems most likely due to PR 91427. The patch for PR 91427, made it sound like it was defect report for earlier versions of the C++ standards too: For the time being I'm limiting the new semantics to C++20 mode; since it was moved as a DR, we will probably want to apply the change to other standard modes as well once we have a better sense of the impact on existing code, probably in GCC 12.