This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]