// Parse the third part of the for specifier.
if (Tok.isNot(tok::r_paren)) { // for (...;...;)
+ // This is needed to compile QT 4.8.4, which uses statement
+ // expression with 'break' in it.
+ ForScope.SetFlags(Scope::BreakScope);
+
ExprResult Third = ParseExpression();
// FIXME: The C++11 standard doesn't actually say that this is a
// discarded-value expression, but it clearly should be.
void pr8880_7() {
for (int i = 0 ; i != 10 ; i++ ) {
- for ( ; ; ({ ++i; break; })) { // expected-error {{'break' statement not in loop or switch statement}}
+ for ( ; ; ({ ++i; continue; })) { // expected-error {{'continue' statement not in loop statement}}
}
}
}
-void pr8880_8() {
+// Have to allow 'break' in the third part of 'for' specifier to enable compilation of QT 4.8 macro 'foreach'
+void pr17649() {
for (int i = 0 ; i != 10 ; i++ )
- for ( ; ; ({ ++i; break; })) { // expected-error {{'break' statement not in loop or switch statement}}
+ for ( ; ; ({ ++i; break; })) {
}
}
// Moved from Analysis/dead-stores.c
void rdar8014335() {
- for (int i = 0 ; i != 10 ; ({ break; })) { // expected-error {{'break' statement not in loop or switch statement}}
- for ( ; ; ({ ++i; break; })) ; // expected-error {{'break' statement not in loop or switch statement}}
+ for (int i = 0 ; i != 10 ; ({ break; })) {
+ for ( ; ; ({ ++i; break; })) ;
+ i = i * 3;
+ }
+}
+
+void pr17649_2() {
+ for (int i = 0 ; i != 10 ; ({ continue; })) { // expected-error {{'continue' statement not in loop statement}}
+ for ( ; ; ({ ++i; continue; })) ; // expected-error {{'continue' statement not in loop statement}}
i = i * 3;
}
}