
David Abrahams wrote:
[...] So you're basically saying that in my suggested text: "A temporary of type ``cv1 T2'' [sic] is constructed using direct initialization from the rvalue object. The reference is bound to
"Rani Sharoni" <rani_sharoni@hotmail.com> writes: the temporary or to a sub-object within the temporary"
the mention of direct initialization is pointless and could be written :
"A temporary of type ``cv1 T2'' [sic] is initialized from the rvalue object. The reference is bound to the temporary or to a sub-object within the temporary"
??
I think the text has to account for the possibility that the constructor used might be explicit, doesn't it?
This is true but explicit copy (or copying) constructor is quite useless (unless someone will find a way to abuse it for good purpose). Raoul Gough and I have tried to relax this surprising reference binding limitation (i.e. requires copying constroctor) for the favor of wider range of cases (e.g. private copy constructor). The suggestion basically says that *direct reference binding* is enough for most cases of class rvalue bindings. http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#391
IMO your suggestion is fully compliant and EDG has bug that confuses everyone.
I don't have anything else to add to this discussion.
Maybe some more.
Sorry to draw it out, but I don't understand when you say "suggestion" whether you're referring to my suggested text change or the movable class idiom I posted.
The later. For the moveable class Idiom you don't need to revise the standard text since Steve Adamczyk already did that ~7 years ago when he removed the copy constructor requirement. You only encountered a bug in EDG which is also inconsistent: struct A { // private: template<typename T> A(T const& r) { int const* p = &r; // error if T != int -> error if T == A p = p; } private: A(A&); }; int f(A const&); // template constructor is // enough for the "illusive coping" int x = f(A(10)); // compiled fine using EDG and GCC Making the template *converting* constructor private will trigger access error for both EDG and GCC although they don't actually call it. VC rejected this code and has open bug for this issue. Again DR #391: <Q> J. Stephen Adamczyk replied that the reason for changing "a copy constructor" to "a constructor" was to allow for member template *converting* constructors.</Q> In your moveable implementation the converting constructor (i.e. X(ref)) is as good as template converting constructor from overloading pov which makes your code *fully compliant* within the current standard text. Cheers!
No alarms and not surprises silence.
Wow, parse error again. Radiohead?
Right, I'm a loyal fan. Regards, Rani