https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62115
Roman Perepelitsa <roman.perepelitsa at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roman.perepelitsa at gmail dot com --- Comment #4 from Roman Perepelitsa <roman.perepelitsa at gmail dot com> --- r216124 has also fixed another bug, which may result in valid code being rejected and also in incorrect code generation for valid code. #include <utility> struct Base { int value; }; struct Derived : Base {}; void Foo(int&&) {} int main() { Derived d; Foo(std::move(d).value); } Before r216124 this program produced the following compile error: test.cc: In function 'int main()': test.cc:10:25: error: cannot bind 'int' lvalue to 'int&&' Foo(std::move(d).value); ^ test.cc:6:6: error: initializing argument 1 of 'void Foo(int&&)' void Foo(int&&) {} If function Foo() was overloaded for const int& and int&, or if it used perfect forwarding, it would result in successful compilation and incorrect runtime behaviour. Would it be possible to backport the fix to gcc-4_9-branch?