[cfe-commits] r67059 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ lib/AST/ lib/CodeGen/ lib/Sema/ test/Parser/ test/SemaCXX/

Howard Hinnant hhinnant at apple.com
Tue Mar 17 09:03:39 PDT 2009


On Mar 17, 2009, at 1:09 AM, Sebastian Redl wrote:

>>> +  if (LValueRef) {
>>> +    if (const RValueReferenceType *R = T->getAsRValueReferenceType
>>> ()) {
>>> +      // FIXME: Find the C++0x reference for reference collapsing.
>>> +      // In reference collapsing, lvalue refs win over rvalue refs.
>>> +      return Context.getLValueReferenceType(R->getPointeeType()).
>>> +               getQualifiedType(Quals);
>>> +    }
>>> +  }
>>
>> IIRC, in the reference-collapsing case we drop the qualifiers applied
>> to the outer reference.
>>
>
> So, drop the getQualifiedType()?

I don't think "drop outer" quite does it.

[dcl.typedef], p9:

> If a typedef TD names a type that is a reference to a type T, an  
> attempt to create the type “lvalue reference
> to cv TD” creates the type “lvalue reference to T,” while an attempt  
> to create the type “rvalue reference to
> cv TD” creates the type TD.

(examples follow)

[temp.arg.type], p4:

> If a template-argument for a template-parameter T names a type that  
> is a reference to a type A, an attempt
> to create the type “lvalue reference to cv T” creates the type  
> “lvalue reference to A,” while an attempt to
> create the type “rvalue reference to cv T” creates the type T  
> [ Example: ...

My informal summary with gross pseudo code:

& & -> &
& && -> &
&& & -> &
&& && -> &&

Thanks much.

-Howard





More information about the cfe-commits mailing list