Fix syntaxError for struct initialization
This commit is contained in:
parent
a309095ec3
commit
64ef879ebf
|
@ -9272,11 +9272,12 @@ 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%"))
|
||||
syntaxError(tok);
|
||||
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
||||
if (!Token::Match(tok->next(), "template|operator|*|~|%name%"))
|
||||
syntaxError(tok);
|
||||
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7694,6 +7694,8 @@ private:
|
|||
|
||||
// after (expr)
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("void f() { switch (a) int b; }"));
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("S s = { .x=2, .y[0]=3 };"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue