On Mon, Nov 4, 2013 at 11:14 AM, Jordan Rose <[email protected]> wrote:

>
> On Nov 4, 2013, at 11:13, David Majnemer <[email protected]> wrote:
>
> On Mon, Nov 4, 2013 at 9:09 AM, Jordan Rose <[email protected]> wrote:
>
>>
>> On Nov 2, 2013, at 3:38 , David Majnemer <[email protected]>
>> 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
>
>
> Right, but in C++?
>
> ...actually, it seems that we *do* accept this in C++ (before and after
> your patch). Does GCC?
>

Yes, with the following diagnostic under -pedantic:

warning: ISO C++ forbids zero-size array ‘b’ [-Wpedantic]


>
> Jordan
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to