aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/stmt-expr-label-2.c
blob: 863d610545c3441da60a6a19f651a70a8994fdfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Test for labels in statement expressions: bugs 772 and 17913.
   switch statements must not jump into statement expressions.  */

/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-options "" } */

void
f (int a)
{
  switch (a)
    {
    case 0:
    case 1:
      ({
      case 2: /* { dg-error "error: case label in statement expression not containing enclosing switch statement" } */
      default: /* { dg-error "error: 'default' label in statement expression not containing enclosing switch statement" } */
	switch (a)
	  {
	  case 3:
	  default:
	    ;
	  }
	0;
      });
    }
}