From c30333425bd4cb50f04b5fc9c9028b9f962432c9 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Tue, 24 May 2022 09:21:21 +0200 Subject: [PATCH] Added a regression test for ticket #8892 - FN: knownConditionTrueFalse --- test/testcondition.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index ee09454f7..aea3f33f7 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -1642,6 +1642,12 @@ private: } void secondAlwaysTrueFalseWhenFirstTrueError() { + check("void f(void) {\n" // #8892 + " const char c[1] = { \'x\' }; \n" + " if(c[0] == \'x\'){;}\n" + "}"); + ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'c[0]=='x'' is always true\n", errout.str()); + check("void f(int x) {\n" " if (x > 5 && x != 1)\n" " a++;\n"