[PATCH] rvalue reference implementation for C++0x
Russell Yanofsky
russ@yanofsky.org
Thu Apr 26 01:43:00 GMT 2007
On Wed, 2007-04-25 at 20:06 -0400, Russell Yanofsky wrote:
> > g++.dg/overload/arg1.C
> > g++.dg/overload/arg4.C
>
> These two cases do look like bugs, I'll have to see what causes them.
On second thought, I don't think these are bugs. The problem in both of
these cases is trying to initialize an automatic variable of type B from
a temporary object of type B where B is declared like:
struct A {};
struct B : A
{
B(int);
B(B &);
B(A);
};
Since B doesn't have a const copy constructor, initializing the variable
directly from the temporary is impossible. But the class A has an
implicit const copy constructor which is allowed to bind to temporary
instances of B under C++0x. Before C++0x, binding to those instances was
not possible because B is uncopyable. But the new rules do not require a
temporary to be copyable to bind a const reference to it. So under the
new rules, these test cases aren't errors.
--
- Russell Yanofsky (PGP ID: 0x5FAA0216)
- http://russ.yanofsky.org/
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070426/dc723b3c/attachment.sig>
More information about the Gcc-patches
mailing list