[cfe-commits] r130024 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaCXXCast.cpp test/SemaCXX/reinterpret-cast.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Apr 22 15:51:58 PDT 2011


On Apr 22, 2011, at 3:44 PM, Eli Friedman wrote:

> On Fri, Apr 22, 2011 at 3:31 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
>> +
>> +    // Cannot get address of a bitfield.
>> +    if (SrcExpr.get()->getObjectKind() == OK_BitField) {
>> +      msg = diag::err_bad_reinterpret_cast_bitfield;
>> +      return TC_NotApplicable;
>> +    }
> 
> I think you need to handle OK_VectorComponent and OK_ObjCProperty as
> well; AFAICT, this doesn't handle, for example, the following related
> case:
> __attribute((ext_vector_type(4))) typedef float v4;
> float& x(v4 &a) { return reinterpret_cast<float&>(a[1]); }

Right, another approach is needed, thanks!

> 
> -Eli




More information about the cfe-commits mailing list