[cfe-dev] clang bug or gcc misfeature?

Paolo Bolzoni bolzoni at cs.unipr.it
Mon Feb 9 11:07:36 PST 2009


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.

thanks
pb



More information about the cfe-dev mailing list