[cfe-dev] Fixes for References

Chris Lattner clattner at apple.com
Mon Jul 16 15:10:54 PDT 2007


>> That's the problem: after calling DefaultFunctionArrayConversion,  
>> the expr returned should have its reference stripped off with an  
>> implicit conversion.
>>
>> One invariant is that the type (current) returned by  
>> DefaultFunctionArrayConversion should always be the type of the expr.
>>
> Then that makes my patch even simpler. Here's the relevant part:

Nice, now we're getting there :)

> +  if (const ReferenceType *ref = dyn_cast<ReferenceType> 
> (t.getCanonicalType()))
> +    t = promoteExprToType(e, ref->getReferenceeType()); // C++ 5p6

Plz use a textual spec citation instead of a numeric one [foo.bar].   
Other than that, it looks ok, please commit.

It would be nice to refactor the code so that UsualUnaryConversions  
only needs to check for references once, but I'm not sure if that is  
possible.

As a follow on patch, please eliminate the call to getCanonicalType  
by enhancing the Type::isReferenceType() predicate to return the  
reference type (like we now do for pointer type).  This will allow  
you to retain the typedef info for reference typedefs.

-Chris



More information about the cfe-dev mailing list