blob: c256960af1da49a860bb67c567d9f819dd7d30d7 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Edward O'Callaghan12356b12009-10-17 19:32:54 +00002
3void test() {
4 bool x = true;
5 switch (x) { // expected-warning {{bool}}
6 case 0:
7 break;
8 }
9
10 int n = 3;
11 switch (n && 1) { // expected-warning {{bool}}
12 case 1:
13 break;
14 }
15}
Douglas Gregor84fb9c02009-11-23 13:46:08 +000016
17// PR5518
18struct A {
19 operator int(); // expected-note{{conversion to integral type}}
20};
21
22void x() {
23 switch(A()) {
24 }
25}
26
27enum E { e1, e2 };
28struct B : A {
29 operator E() const; // expected-note{{conversion to enumeration type}}
30};
31
32void x2() {
33 switch (B()) { // expected-error{{multiple conversions}}
34 }
35}
Douglas Gregorf21bac62009-11-23 13:53:21 +000036
37struct C; // expected-note{{forward declaration}}
38
39void x3(C &c) {
40 switch (c) { // expected-error{{incomplete class type}}
41 }
42}