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++/32658] Supposedly illegal conversion compiles without errors



------- Comment #8 from widman at gimpel dot com  2007-08-02 17:07 -------
(In reply to comment #7)
> (In reply to comment #6) 
> > Is it possible that rvalue references will give you an alternative for the
> > desired effect?  See the relevant papers linked to from here:
> > 
> > http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2291.html
> > 
> 
> This would mean that instead of A::A(A &), I wrote A::A(A &&) and passing
> temporaries would automatically work?

That's correct.  Rvalues  would bind directly to the 'A&&' parameter; you could
even have two ctors:
struct A {
 A(const A&);   // copy ctor
 A(A&&);          // move ctor
};
...and when you initialize an 'A' with an rvalue, overload resolution will
select the move ctor.


-- 


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


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