Re: Bug in C FE or difference between C & C++

2010-06-02 Thread Gabriel Dos Reis
On Wed, Jun 2, 2010 at 5:00 AM, Bingfeng Mei wrote: > Hi, > > For the following simple example, > > int main(void) > { >  int a=0; >  switch (a) >    { >    case 0: >     int b=2; >     break; >     } > } > > GCC will complain: > tst.c: In function 'main': > tst.c:7:6: error: a label can only be p

Re: Bug in C FE or difference between C & C++

2010-06-02 Thread Richard Guenther
On Wed, Jun 2, 2010 at 12:00 PM, Bingfeng Mei wrote: > Hi, > > For the following simple example, > > int main(void) > { >  int a=0; >  switch (a) >    { >    case 0: >     int b=2; >     break; >     } > } > > GCC will complain: > tst.c: In function 'main': > tst.c:7:6: error: a label can only be

Bug in C FE or difference between C & C++

2010-06-02 Thread Bingfeng Mei
Hi, For the following simple example, int main(void) { int a=0; switch (a) { case 0: int b=2; break; } } GCC will complain: tst.c: In function 'main': tst.c:7:6: error: a label can only be part of a statement and a declaration is not a statement G++ will compil