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