This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue



------- Comment #1 from redi at gcc dot gnu dot org  2010-05-16 17:07 -------
The rules say that for copy-initialization where the source type (X&&) is not
the same as the destination type (X) a temporary is created. That temporary is
copy-constructed from x, then y is move-constructed from the temporary.

To avoid the temporary use direct-initialization;

Y y( static_cast<X&&>(x) );


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]