Add another check to Tokenizer::validateC(): C++ casts

This commit is contained in:
Alexander Mai 2017-05-03 16:57:42 +02:00
parent 1225b4b25a
commit e88b4dcf06
1 changed files with 3 additions and 0 deletions

View File

@ -8053,6 +8053,9 @@ void Tokenizer::validateC() const
if (!isC())
return;
for (const Token *tok = tokens(); tok; tok = tok->next()) {
// That might trigger false positives, but it's much faster to have this truncated pattern
if (Token::simpleMatch(tok, "const_cast|dynamic_cast|reinterpret_cast|static_cast <"))
syntaxErrorC(tok, "C++ cast <...");
// Template function..
if (Token::Match(tok, "%name% < %name% > (")) {
const Token *tok2 = tok->tokAt(5);