X Tutup
Skip to content

Commit 7002f9d

Browse files
committed
Merge branch 'master' of https://github.com/danmar/cppcheck
2 parents 3941601 + dfb015a commit 7002f9d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2792,7 +2792,7 @@ void Tokenizer::setVarId()
27922792

27932793
const Token* tokStart = tok->tokAt(2);
27942794
while (tokStart && tokStart->str() != "{") {
2795-
if (Token::Match(tokStart, "public|private|protected"))
2795+
if (Token::Match(tokStart, "public|private|protected %name%"))
27962796
tokStart = tokStart->next();
27972797
if (tokStart->strAt(1) == "," || tokStart->strAt(1) == "{")
27982798
varlist[classname].insert(varlist[tokStart->str()].begin(), varlist[tokStart->str()].end());

test/testgarbage.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class TestGarbage : public TestFixture {
8282
TEST_CASE(garbageCode41); // #6685
8383
TEST_CASE(garbageCode42); // #5760
8484
TEST_CASE(garbageCode43); // #6703
85+
TEST_CASE(garbageCode44); // #6704
8586

8687
TEST_CASE(garbageValueFlow);
8788
TEST_CASE(garbageSymbolDatabase);
@@ -475,6 +476,10 @@ class TestGarbage : public TestFixture {
475476
checkCode("int { }; struct A<void> a = { }");
476477
}
477478

479+
void garbageCode44() { // #6704
480+
ASSERT_THROW(checkCode("{ { }; }; { class A : }; public typedef b;"), InternalError);
481+
}
482+
478483
void garbageValueFlow() {
479484
// #6089
480485
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"

0 commit comments

Comments
 (0)
X Tutup