From 55230baf781aa7e7f44ba40af00a4daf3bedcdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 11 Sep 2011 09:46:01 +0200 Subject: [PATCH] Fixed #3086 (false positive: Boolean result is used in bitwise operation.) --- lib/checkother.cpp | 2 +- test/testother.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index fbf46509e..0cd865d9f 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -195,7 +195,7 @@ void CheckOther::clarifyCondition() if (Token::Match(tok2, "[&|^]")) { // don't write false positives when templates are used - if (Token::Match(tok, "<|>") && !code_is_c() && tok2->str() == "&") + if (Token::Match(tok, "<|>") && Token::Match(tok2, "& ,|>")) continue; clarifyConditionError(tok,false,true); diff --git a/test/testother.cpp b/test/testother.cpp index 916b47e95..f9cdc2270 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -2828,6 +2828,9 @@ private: check("void f() { A a; }"); ASSERT_EQUALS("", errout.str()); + check("class A;", "test.C"); + ASSERT_EQUALS("", errout.str()); + check("void f() {\n" " if (result != (char *)&inline_result) { }\n" "}");