File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -811,6 +811,7 @@ namespace {
811811 } else if (Token::simpleMatch (tok, " switch (" )) {
812812 if (updateRecursive (tok->next ()->astOperand2 ()) == Progress::Break)
813813 return Break ();
814+ actions |= Analyzer::Action::Write; // bailout for switch scope
814815 return Break ();
815816 } else if (Token* callTok = callExpr (tok)) {
816817 // TODO: Dont traverse tokens a second time
Original file line number Diff line number Diff line change @@ -4632,6 +4632,26 @@ class TestCondition : public TestFixture {
46324632 " return;\n "
46334633 " }\n " );
46344634 ASSERT_EQUALS (" " , errout_str ());
4635+
4636+ check (" int h();\n "
4637+ " bool g() {\n "
4638+ " bool b{};\n "
4639+ " try {\n "
4640+ " int x = h();\n "
4641+ " switch (x) {\n "
4642+ " default:\n "
4643+ " b = true;\n "
4644+ " }\n "
4645+ " }\n "
4646+ " catch (...) {\n "
4647+ " b = false;\n "
4648+ " }\n "
4649+ " return b;\n "
4650+ " }\n "
4651+ " void f() {\n "
4652+ " if (g()) {}\n "
4653+ " }\n " );
4654+ ASSERT_EQUALS (" " , errout_str ());
46354655 }
46364656
46374657 void alwaysTrueSymbolic ()
You can’t perform that action at this time.
0 commit comments