@@ -2995,6 +2995,7 @@ statement is the top block of a GNU statement expression ({ ... }).
29952995 } /* if */
29962996 sssep -> switch_has_dependent_case
29972997 = FALSE;
2998+ sssep -> in_switch_condition = FALSE;
29982999 sssep -> contains_user_label = FALSE;
29993000 sssep -> contains_active_switch_case = FALSE;
30003001 sssep -> record_declared_entities = FALSE;
@@ -3538,8 +3539,9 @@ static a_struct_stmt_stack_entry_ptr find_enclosing_struct_stmt(
35383539 a_boolean find_loop )
35393540/*
35403541Search the structured statement stack from the current entry outward,
3541- looking for a switch statement (if find_switch is TRUE) or a loop
3542- statement (while, do, or for; if find_loop is TRUE). Return a pointer
3542+ looking for a switch statement whose condition is not being scanned (if
3543+ find_switch is TRUE) or a loop statement (while, do, or for; if find_loop is
3544+ TRUE). Return a pointer
35433545to the first structured statement stack entry found, or NULL if none
35443546was found.
35453547*/
@@ -3552,7 +3554,7 @@ was found.
35523554 the compound statement that defines the function. */
35533555 while (sssep != & struct_stmt_stack [0 ]) {
35543556 kind = sssep -> kind ;
3555- if (find_switch && kind == ssk_switch ) {
3557+ if (find_switch && kind == ssk_switch && ! sssep -> in_switch_condition ) {
35563558 goto found ;
35573559 } else if (find_loop &&
35583560 (kind == ssk_while || kind == ssk_do || kind == ssk_for ||
@@ -4589,7 +4591,9 @@ See also 3.6.4.2.
45894591 (void )required_token (tok_lparen , ec_exp_lparen );
45904592 add_stop_token (tok_rparen );
45914593 /* Scan the "condition", which in C++ may be a condition declaration. */
4594+ struct_stmt_stack [depth_stmt_stack ].in_switch_condition = TRUE;
45924595 scan_condition (sp , & is_condition_decl );
4596+ struct_stmt_stack [depth_stmt_stack ].in_switch_condition = FALSE;
45934597 if (!is_error_node (sp -> expr )) {
45944598 /* Issue a remark if the selector is constant. */
45954599 if (is_constant_node (skip_parens (sp -> expr ))) {
0 commit comments