Skip ast validation inside template (#2661)

This commit is contained in:
Ken-Patrick Lehrmann 2020-05-23 21:11:08 +02:00 committed by GitHub
parent 7b7d96ee4c
commit 084529575f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -1564,14 +1564,17 @@ void TokenList::validateAst() const
safeAstTokens.insert(tok);
}
// Don't check templates
if (tok->str() == "<" && tok->link()) {
tok = tok->link();
continue;
}
// Check binary operators
if (Token::Match(tok, "%or%|%oror%|%assign%|%comp%")) {
// Skip lambda captures
if (Token::Match(tok, "= ,|]"))
continue;
// Don't check templates
if (tok->link())
continue;
// Skip pure virtual functions
if (Token::simpleMatch(tok->previous(), ") = 0"))
continue;

View File

@ -8228,6 +8228,8 @@ private:
" d e = {(p1)...};\n"
" }\n"
"};\n"));
ASSERT_NO_THROW(tokenizeAndStringify("a<b?0:1>()==3;"));
}
void checkNamespaces() {