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

John McCall rjmccall at apple.com
Fri Apr 22 17:06:03 PDT 2011


On Apr 22, 2011, at 4:57 PM, Argyrios Kyrtzidis wrote:
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Fri Apr 22 18:57:57 2011
> @@ -1327,9 +1327,18 @@
>     //   same effect as the conversion *reinterpret_cast<T*>(&x) with the
>     //   built-in & and * operators.
> 
> -    // Cannot get address of a bitfield.
> -    if (SrcExpr.get()->getObjectKind() == OK_BitField) {
> -      msg = diag::err_bad_reinterpret_cast_bitfield;
> +    const char *inappropriate = 0;
> +    switch (SrcExpr.get()->getObjectKind()) {
> +    default: break;
> +    case OK_BitField:        inappropriate = "bit-field";           break;
> +    case OK_VectorComponent: inappropriate = "vector element";      break;
> +    case OK_ObjCProperty:    inappropriate = "property expression"; break;
> +    }

Please do an exhaustive switch, especially since there's only one other case. :)

John.



More information about the cfe-commits mailing list