[cfe-commits] r134785 - /cfe/trunk/lib/CodeGen/CGDecl.cpp

John McCall rjmccall at apple.com
Fri Jul 8 22:50:51 PDT 2011


On Jul 8, 2011, at 10:47 PM, Francois Pichet wrote:

> On Fri, Jul 8, 2011 at 10:30 PM, John McCall <rjmccall at apple.com> wrote:
>> Author: rjmccall
>> Date: Fri Jul  8 21:30:03 2011
>> New Revision: 134785
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=134785&view=rev
>> Log:
>> GCC 4.2 compatibility hack.
>> 
>> 
>> Modified:
>>    cfe/trunk/lib/CodeGen/CGDecl.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=134785&r1=134784&r2=134785&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Fri Jul  8 21:30:03 2011
>> @@ -1099,11 +1099,12 @@
>> 
>>  CodeGenFunction::Destroyer &
>>  CodeGenFunction::getDestroyer(QualType::DestructionKind kind) {
>> +  // GCC 4.2 requires the *& on these function references.
>>   switch (kind) {
>>   case QualType::DK_none: llvm_unreachable("no destroyer for trivial dtor");
>> -  case QualType::DK_cxx_destructor: return destroyCXXObject;
>> -  case QualType::DK_objc_strong_lifetime: return destroyARCStrongPrecise;
>> -  case QualType::DK_objc_weak_lifetime: return destroyARCWeak;
>> +  case QualType::DK_cxx_destructor: return *&destroyCXXObject;
>> +  case QualType::DK_objc_strong_lifetime: return *&destroyARCStrongPrecise;
>> +  case QualType::DK_objc_weak_lifetime: return *&destroyARCWeak;
>>   }
> 
> MSVC doesn't like this hack:
> 
> 38>CGDecl.cpp(1105): error C2276: '*' : illegal operation on bound
> member function expression
> 38>CGDecl.cpp(1106): error C2276: '*' : illegal operation on bound
> member function expression
> 38>CGDecl.cpp(1107): error C2276: '*' : illegal operation on bound
> member function expression

What?  MSVC is crazy, these are static functions.

Would you mind playing with this and figuring out what MSVC will accept?

John.



More information about the cfe-commits mailing list