File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2256,8 +2256,11 @@ void Scope::getVariableList()
22562256
22572257 // skip return and delete
22582258 else if (Token::Match (tok, " return|delete" )) {
2259- while (tok->next () && tok->next ()->str () != " ;" )
2259+ while (tok->next () &&
2260+ tok->next ()->str () != " ;" &&
2261+ tok->next ()->str () != " }" /* ticket #4994 */ ) {
22602262 tok = tok->next ();
2263+ }
22612264 continue ;
22622265 }
22632266
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ class TestOther : public TestFixture {
7575 TEST_CASE (varScope16);
7676 TEST_CASE (varScope17);
7777 TEST_CASE (varScope18);
78+ TEST_CASE (varScope19); // Ticket #4994
7879
7980 TEST_CASE (oldStylePointerCast);
8081 TEST_CASE (invalidPointerCast);
@@ -1081,6 +1082,15 @@ class TestOther : public TestFixture {
10811082 ASSERT_EQUALS (" " , errout.str ());
10821083 }
10831084
1085+ void varScope19 () { // Ticket #4994
1086+ varScope (" long f () {\n "
1087+ " return a >> extern\n "
1088+ " }\n "
1089+ " long a = 1 ;\n "
1090+ " long b = 2 ;" );
1091+ ASSERT_EQUALS (" " , errout.str ());
1092+ }
1093+
10841094 void checkOldStylePointerCast (const char code[]) {
10851095 // Clear the error buffer..
10861096 errout.str (" " );
You can’t perform that action at this time.
0 commit comments