diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index ef959e4eb..8573f6ea6 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9358,11 +9358,11 @@ void Tokenizer::findGarbageCode() const if (Token::simpleMatch(tok, ".") && !Token::simpleMatch(tok->previous(), ".") && !Token::simpleMatch(tok->next(), ".") && - !Token::Match(tok->previous(), "{|, . %name% =") && + !Token::Match(tok->previous(), "{|, . %name% [=.]") && !Token::Match(tok->previous(), ", . %name%")) { - if (!Token::Match(tok->previous(), ")|]|>|}|%name%")) + if (!Token::Match(tok->previous(), "%name%|)|]|>|}")) syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1)); - if (!Token::Match(tok->next(), "template|operator|*|~|%name%")) + if (!Token::Match(tok->next(), "%name%|*|~")) syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1)); } } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 4e68a4187..003506c67 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7700,6 +7700,7 @@ private: ASSERT_NO_THROW(tokenizeAndStringify("void f() { switch (a) int b; }")); ASSERT_NO_THROW(tokenizeAndStringify("S s = { .x=2, .y[0]=3 };")); + ASSERT_NO_THROW(tokenizeAndStringify("S s = { .ab.a=2, .ab.b=3 };")); }