r193919 - Sema: Cleanup and simplify anonymous union diagnostics

David Majnemer david.majnemer at gmail.com
Mon Nov 4 11:13:28 PST 2013


On Mon, Nov 4, 2013 at 9:09 AM, Jordan Rose <jordan_rose at apple.com> wrote:

>
> On Nov 2, 2013, at 3:38 , David Majnemer <david.majnemer at gmail.com> wrote:
>
> +                     : getLangOpts().CPlusPlus
> +                           ? diag::ext_flexible_array_union_gnu
> +                           : diag::err_flexible_array_union;
>
>
> This doesn't look right. Flexible array members in unions shouldn't be an
> extension in C++ if they're disallowed in C.
>

My patch doesn't change this behavior.

Given:
union x { int a; int b[]; };

clang in c99 or c89:
error: field has incomplete type 'int []'

gcc in c99 or c89:
error: flexible array member in union

-- 
David Majnemer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131104/96496ba6/attachment.html>


More information about the cfe-commits mailing list