[PATCH] rvalue reference implementation for C++0x

Jason Merrill jason@redhat.com
Wed May 30 21:11:00 GMT 2007


Doug Gregor wrote:
>> It doesn't look like the reference collapsing code properly combines
>> cv-quals from the two references.
> 
> According to [temp.arg.type p4] of N2284 (the latest working paper),
> the reference-collapsing code is doing the right thing. cv-qualifiers
> on the outer reference are supposed to be dropped.

Ah, you're right.  The WP has gone back and forth on this point, and I 
was looking at older sources.

> Also in this patch, I've also included my patch to re-enable the
> return value optimization for types with move constructors, which was
> (accidentally) disabled by code that move-constructs from an rvalue.
> See the following (short) thread for more information about this
> patch:
> 
>  http://gcc.gnu.org/ml/gcc/2007-05/msg00163.html

This looks OK, except that I wouldn't check for c++0x mode in 
build_over_call.  If you can't have a move constructor except in c++0x 
mode and you think shortcutting will speed up non-0x mode significantly, 
put the test in the macro or in move_fn_p.

Please put back the explanation in convert_like_real of why we need the 
temporary.

Go ahead and check this all in with these changes if it passes testing.

Jason



More information about the Gcc-patches mailing list