https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61504
Bug ID: 61504 Summary: Move elision after cast to rvalue reference Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dyp-cpp at gmx dot net Created attachment 32935 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32935&action=edit Test case as in description. Move elision is applied even though the object has been bound to a reference (see [class.copy]/31). Test case: --------------- #include <iostream> struct loud { loud() { std::cout << "default\n"; } loud(loud &&) { std::cout << "move\n"; } ~loud() { std::cout << "dtor\n"; } }; int main() { loud l1{ static_cast<loud&&>(loud{}) }; } ------------------ Expected output (also, recent clang++): default move dtor dtor Output produced by g++ -std=c++11 -Wall -Wextra -pedantic 4.10.0 20140611: default dtor Possibly related: http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1376