[Bug c++/54509] If Move constructor is templatized then it is invoked else not
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 7 05:38:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54509
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-09-07 05:37:56 UTC ---
The language requires that the presence of a user-declared copy-constructor
(which you have used in your code) shall prevent the compiler-declared move
constructor. When _BUG_ is defined, the effect is that the class has a copy
constructor and a template constructor
template<typename T>
Test(T &&);
but *no* move constructor. The template constructor will always be a better
match for rvalue arguments than the copy constructor, therefore it is called
twice in your program.
In other words: The behavior of gcc looks correct and this report seems invalid
to me.
More information about the Gcc-bugs
mailing list