This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52655] right shit in switch: gcc compiles with error: label at end of compound statement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52655

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> 2012-03-21 11:29:40 UTC ---
(In reply to comment #0)
> The following code compiles with error: label at end of compound statement with
> the gcc 4.6.1 compiler.
> 
> Content of t.c:
> ----8<----
> void
> foo (int op)
> {
>   int x = 100000 >> 3;  /* OK */
> 
>   switch (op)
>     {
>     case 0:
>       x = 100000 >> 3;       /* t.c:12:5: error: label at end of compound
> statement */
>       break;
> 
>     default:

The "default:" acts as a label, and it needs a statement after it.  Just add
";" after it, or delete it.  The shift has nothing to do with this issue.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]