From 388b5118df9f234e27bbc6291707027fa0fbd3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 21 Feb 2020 17:15:33 +0100 Subject: [PATCH] Fixed bad ast (wrong result from iscast()) --- lib/tokenlist.cpp | 2 +- test/testtokenize.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index fe4b6e603..3a76a5c46 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -445,7 +445,7 @@ static bool iscast(const Token *tok) if (Token::Match(tok->link(), ") }|)|]|;")) return false; - if (Token::Match(tok->link(), ") %cop%") && !Token::Match(tok->link(), ") [&*+-~]")) + if (Token::Match(tok->link(), ") %cop%") && !Token::Match(tok->link(), ") [&*+-~!]")) return false; if (Token::Match(tok->previous(), "= ( %name% ) {") && tok->next()->varId() == 0) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index d93b184f5..da847406f 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7808,6 +7808,8 @@ private: ASSERT_EQUALS("yz.(return", testAst("return (x)(y).z;")); + ASSERT_EQUALS("fon!(restoring01:?,(", testAst("f((long) !on, restoring ? 0 : 1);")); + // not cast ASSERT_EQUALS("AB||", testAst("(A)||(B)")); ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;"));