[cfe-dev] array extended initializer lists

Alexander Potapenko glider at google.com
Tue Jul 24 03:25:20 PDT 2012


This is not a correct program, so I don't think any option exists to compile it.
You can't compile this program with gcc as well:
$ gcc t.c -o t
t.c: In function ‘main’:
t.c:3: error: expected expression before ‘{’ token


On Tue, Jul 24, 2012 at 2:19 PM, Vinxxe <vinxxe at gmail.com> wrote:
> Hi,
> is it possible, with some compiler option, to compile the following
> code with clang?
> //------------------------------------
> int main(){
>
>   int x[10];
>
>   x={1,2,3,4,5,6,7,8,9,0};
>
> }
> //-------------------------------------
>
>
> I tried this
>
> clang -c main.cc -std=gnu++11
>
> and got the following error:
>
> main.cc:5:4: error: array type 'int [10]' is not assignable
>   x={1,2,3,4,5,6,7,8,9,0};
>
> then without options
>
> clang -c main.cc
>
> I got the following error:
>
> main.cc:5:5: error: expected expression
>   x={1,2,3,4,5,6,7,8,9,0};
>
> thank you
>
> V
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



-- 
Alexander Potapenko
Software Engineer
Google Moscow




More information about the cfe-dev mailing list