Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8837,6 +8837,8 @@ void Tokenizer::findGarbageCode() const
if (tok->str() == ";") { // do the counting
semicolons++;
} else if (tok->str() == ":") {
if (tok->strAt(-1) == ",")
syntaxError(tok);
colons++;
} else if (tok->str() == ")") { // skip pairs of ( )
tok = tok->link();
Expand Down Expand Up @@ -8960,8 +8962,6 @@ void Tokenizer::findGarbageCode() const
syntaxError(tok);
if (Token::Match(tok, ": [)]=]"))
syntaxError(tok);
if (Token::simpleMatch(tok, ", :"))
syntaxError(tok);
if (Token::Match(tok, "typedef [,;:]"))
syntaxError(tok);
if (Token::Match(tok, "? %assign%"))
Expand Down
2 changes: 2 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7681,6 +7681,8 @@ class TestTokenizer : public TestFixture {

ASSERT_NO_THROW(tokenizeAndStringify("enum { E = sizeof(struct { int i; }) };")); // #13249

ASSERT_NO_THROW(tokenizeAndStringify("struct S { unsigned u:2, :30; };")); // #14393

ignore_errout();
}

Expand Down
Loading