From 1d910bc3bc8e77335d73829095e9b0aede401bb6 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Thu, 16 Jul 2015 08:44:38 +0200 Subject: [PATCH] #6313: Added test case for oppositeInnerCondition. --- test/testcondition.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 3f1244ad9..199e193db 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -1292,6 +1292,16 @@ private: "}"); ASSERT_EQUALS("", errout.str()); + // #6313 - false postive: opposite conditions in nested if blocks when condition changed + check("void Foo::Bar() {\n" + " if(var){\n" + " --var;\n" + " if(!var){}\n" + " else {}\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + // #5874 - array check("void testOppositeConditions2() {\n" " int array[2] = { 0, 0 };\n" @@ -1303,7 +1313,7 @@ private: ASSERT_EQUALS("", errout.str()); } -// clarify conditions with = and comparison + // clarify conditions with = and comparison void clarifyCondition1() { check("void f() {\n" " if (x = b() < 0) {}\n" // don't simplify and verify this code