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