[Bug c++/40682] [C++0x] Require direct binding of short-lived references to rvalues

dragan at plusplus dot co dot yu gcc-bugzilla@gcc.gnu.org
Wed Jul 8 12:38:00 GMT 2009



------- Comment #2 from dragan at plusplus dot co dot yu  2009-07-08 12:38 -------
Although this is a feature request in the context that the old behavior
was correctly implemented and it will be different in C++0x, it still presents
a bug in the current C++0x implementation. It creates copies of
objects that are returned by a rvalue reference, which would be wrong.
I wasn't _really_ trying to request a new functionality, although
I understand your concern.

However, IMHO in this particular case we are talking about one of
the most fundamental features (binding a reference). This change
could also expose possible bugs in the (user and library) code that
relies on creation of a temporary, which even in C++03 is not
considered a portable code. Don't tell me you'd rather deal with
the issue after all the other C++0x stuff gets implemented...

Anyway, my motive was to help the development of GCC. Personally,
I didn't and will not rely on either of the two behaviors, but
will try to write code that works in both situations.


-- 


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



More information about the Gcc-bugs mailing list