[cfe-dev] clang bug or gcc misfeature?

Douglas Gregor dgregor at apple.com
Mon Feb 9 11:12:35 PST 2009


On Feb 9, 2009, at 11:07 AM, Paolo Bolzoni wrote:

> This code:
> designator.c ---->
> struct foo {
>  int arr[10];
> };
>
> struct foo Y[10] = {
>  [1] .arr [1] = 2,
>  [4] .arr [2] = 4
> };
> -----------------<
> is accepted by gcc
> $ gcc -W -Wall -c designator.c
> but refused by clang
>
> $ clang designator.c
> designator.c:7:7: error: field designator cannot initialize a non- 
> struct, non-union type 'int'
>  [4] .arr [2] = 4
>      ^
> 1 diagnostic generated
>
> What is going on? If it is indeed a bug I'll fill-in a report.


Looks like a bug. Please file a bug report.

	- Doug



More information about the cfe-dev mailing list