File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,8 @@ Bug Fixes in This Version
161161 targets that treat ``_Float16 ``/``__fp16 `` as native scalar types. Previously
162162 the warning was silently lost because the operands differed only by an implicit
163163 cast chain. (#GH149967).
164+ - Correct the continue and break scope for while statements to be after the
165+ condition is evaluated.
164166
165167Bug Fixes to Compiler Builtins
166168^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -1734,7 +1734,6 @@ StmtResult Parser::ParseWhileStatement(SourceLocation *TrailingElseLoc) {
17341734 Scope::DeclScope | Scope::ControlScope;
17351735 else
17361736 ScopeFlags = Scope::BreakScope | Scope::ContinueScope;
1737- ParseScope WhileScope (this , ScopeFlags);
17381737
17391738 // Parse the condition.
17401739 Sema::ConditionResult Cond;
@@ -1744,6 +1743,8 @@ StmtResult Parser::ParseWhileStatement(SourceLocation *TrailingElseLoc) {
17441743 Sema::ConditionKind::Boolean, LParen, RParen))
17451744 return StmtError ();
17461745
1746+ ParseScope WhileScope (this , ScopeFlags);
1747+
17471748 // OpenACC Restricts a while-loop inside of certain construct/clause
17481749 // combinations, so diagnose that here in OpenACC mode.
17491750 SemaOpenACC::LoopInConstructRAII LCR{getActions ().OpenACC ()};
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -fsyntax-only -verify %s
2+
3+ void f () {
4+ while (({ continue ; 1 ; })) {
5+ // expected-error@-1 {{'continue' statement not in loop statement}}
6+
7+ }
8+ while (({ break ; 1 ; })) {
9+ // expected-error@-1 {{'break' statement not in loop or switch statement}}
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments