blob: 6c33e8437bd0235f97ce19b8a94596b9aae5cbd4 [file] [log] [blame]
Serge Pavlov09f99242014-01-23 15:05:00 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -fsyntax-only -x c++ -Werror %s
3
4int pr8880_1() {
5 int first = 1;
6 for ( ; ({ if (first) { first = 0; continue; } 0; }); )
7 return 0;
8 return 1;
9}
10
11void pr8880_2(int first) {
12 for ( ; ({ if (first) { first = 0; break; } 0; }); ) {}
13}
14
15void pr8880_3(int first) {
16 for ( ; ; (void)({ if (first) { first = 0; continue; } 0; })) {}
17}
18
19void pr8880_4(int first) {
20 for ( ; ; (void)({ if (first) { first = 0; break; } 0; })) {}
21}
22
23void pr8880_5 (int first) {
24 while(({ if (first) { first = 0; continue; } 0; })) {}
25}
26
27void pr8880_6 (int first) {
28 while(({ if (first) { first = 0; break; } 0; })) {}
29}
30
31void pr8880_7 (int first) {
32 do {} while(({ if (first) { first = 0; continue; } 0; }));
33}
34
35void pr8880_8 (int first) {
36 do {} while(({ if (first) { first = 0; break; } 0; }));
37}
38
39void pr8880_10(int i) {
40 for ( ; i != 10 ; i++ )
41 for ( ; ; (void)({ ++i; continue; i;})) {} // expected-warning{{'continue' is bound to current loop, GCC binds it to the enclosing loop}}
42}
43
44void pr8880_11(int i) {
45 for ( ; i != 10 ; i++ )
46 for ( ; ; (void)({ ++i; break; i;})) {} // expected-warning{{'break' is bound to current loop, GCC binds it to the enclosing loop}}
47}
48
49void pr8880_12(int i, int j) {
50 for ( ; i != 10 ; i++ )
51 for ( ; ({if (i) continue; i;}); j++) {} // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}
52}
53
54void pr8880_13(int i, int j) {
55 for ( ; i != 10 ; i++ )
56 for ( ; ({if (i) break; i;}); j++) {} // expected-warning{{'break' is bound to current loop, GCC binds it to the enclosing loop}}
57}
58
59void pr8880_14(int i) {
60 for ( ; i != 10 ; i++ )
61 while(({if (i) break; i;})) {} // expected-warning {{'break' is bound to current loop, GCC binds it to the enclosing loop}}
62}
63
64void pr8880_15(int i) {
65 while (--i)
66 while(({if (i) continue; i;})) {} // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}
67}
68
69void pr8880_16(int i) {
70 for ( ; i != 10 ; i++ )
71 do {} while(({if (i) break; i;})); // expected-warning {{'break' is bound to current loop, GCC binds it to the enclosing loop}}
72}
73
74void pr8880_17(int i) {
75 for ( ; i != 10 ; i++ )
76 do {} while(({if (i) continue; i;})); // expected-warning {{'continue' is bound to current loop, GCC binds it to the enclosing loop}}
77}
78
79void pr8880_18(int x, int y) {
80 while(x > 0)
81 switch(({if(y) break; y;})) {
82 case 2: x = 0;
83 }
84}
85
86void pr8880_19(int x, int y) {
87 switch(x) {
88 case 1:
89 switch(({if(y) break; y;})) {
90 case 2: x = 0;
91 }
92 }
93}
94
95void pr8880_20(int x, int y) {
96 switch(x) {
97 case 1:
98 while(({if (y) break; y;})) {} //expected-warning {{'break' is bound to loop, GCC binds it to switch}}
99 }
100}
101
102void pr8880_21(int x, int y) {
103 switch(x) {
104 case 1:
105 do {} while(({if (y) break; y;})); //expected-warning {{'break' is bound to loop, GCC binds it to switch}}
106 }
107}
108
109void pr8880_22(int x, int y) {
110 switch(x) {
111 case 1:
112 for ( ; ; (void)({ ++y; break; y;})) {} // expected-warning{{'break' is bound to loop, GCC binds it to switc}}
113 }
114}
115
116void pr8880_23(int x, int y) {
117 switch(x) {
118 case 1:
119 for ( ; ({ ++y; break; y;}); ++y) {} // expected-warning{{'break' is bound to loop, GCC binds it to switch}}
120 }
121}