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: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 31 Oct 2011 07:15:48 +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
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> 2011-10-31 07:15:48 UTC ---
Your expectations are in violation to the standard ;-). The constructor is
selected by overload resolution. The non-template constructor A(const A& a)
would be preferred, if there would be a perfect match (e.g. if you had an
lvalue of type const A), but in your example you have an lvalue of non-const A.
The "perfect-forwarding" template constructor deduces to
template <> A(A& t)
via reference-collapsing, which is a better match for the argument expression
a.
So, this looks like an invalid issue to me.