summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/switch.c
blob: 0128a216e5a32aae8841c0d7c54c6b2a90b349e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: clang -parse-ast-check %s

void f (int z) { 
  while (z) { 
    default: z--;   // expected-error {{statement not in switch}}
  } 
}

void foo(int X) {
  switch (X) {
  case 42: ;          // expected-error {{previous case value}}
  case 5000000000LL:  // expected-warning {{overflow}}
  case 42:            // expected-error {{duplicate case value}}
   ;

  case 100 ... 99: ;  // expected-warning {{empty case range}}
  }
}

void test3(void) { 
  switch (0); 
}

OpenPOWER on IntegriCloud