This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50929] [C++0x] Wrong function selected for overload with template and rvalue reference
- From: "jarrydb at cse dot unsw.edu.au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 31 Oct 2011 10:07:04 +0000
- Subject: [Bug c++/50929] [C++0x] Wrong function selected for overload with template and rvalue reference
- Auto-submitted: auto-generated
- References: <bug-50929-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50929
--- Comment #4 from Jarryd Beck <jarrydb at cse dot unsw.edu.au> 2011-10-31 10:07:04 UTC ---
I didn't realise that A(A&) was a better match. I was thinking of C++ code
where you might write:
template <typename T>
A(const T& t);
A(const A& rhs);
in which case A(const A&) would be chosen. I didn't realise that the rvalue
reference puts a spanner in the works. I was reading the part about a template
function and a non-template function being candidates, and if the non-template
function is no worse than the template function then it is chosen. But I didn't
realise that in this case the non-template one is actually worse.
I suppose that the bug can probably be marked as invalid then.