This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] rvalue reference implementation for C++0x
- From: Jason Merrill <jason at redhat dot com>
- To: Russell Yanofsky <russ at yanofsky dot org>
- Cc: gcc-patches at gcc dot gnu dot org, Jason Merrill <jason at redhat dot com>
- Date: Sun, 11 Mar 2007 17:54:05 -0400
- Subject: Re: [PATCH] rvalue reference implementation for C++0x
- References: <1172076241.31795.32.camel@turtle> <45F1D0F6.5070608@redhat.com> <1173580605.3474.54.camel@turtle>
Russell Yanofsky wrote:
On Fri, 2007-03-09 at 16:26 -0500, Jason Merrill wrote:
The test in compare_ics seems to check for cases where one conversion
has matching rvalueness and the other doesn't, but that isn't all the
rule in the working paper talks about: it also requires that for one ICS
to be better than the other, the two references must differ in
rvalueness, one converting to lvalue ref and the other to rvalue ref or
vice versa.
I don't understand what the difference is. Can you give an example of a
case compare_ics might not handle correctly?
A case where one ICS binds an rvalue reference to an rvalue and the
other binds an rvalue reference to an lvalue. I believe this example is
ambiguous under the rules in the standard, but would be resolved to the
first f with your patch.
struct A {};
struct B {};
struct C
{
operator A();
operator B&();
};
C c;
void f (A&&);
void f (B&&);
int main()
{
f (c);
}
I'll go ahead and do this. Rvalue references have also been implemented
in the Metrowerks Codewarrior compiler, so it might be worth looking at
how that compiler does the mangling also.
Definitely, but does CodeWarrior implement the ia64 C++ ABI?
In the meantime do you want me
to change the patch? Could using a new character code interfere with
debugging tools? I don't even know what character code would make sense
to use for rvalue references..
No, leave it as it is until we have an official mangling.
About the deduce_ref stuff: why not just add the REFERENCE_TYPE to arg
in type_unification_real rather than add another argument to unify?
I think you were looking at the Feb 21 patch instead of the Mar 9 patch.
Yes, I was, I'll look over the latest patch shortly.
Jason