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++/50929] [C++0x] Wrong function selected for overload with template and rvalue reference


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.


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