From 75f69c11b71732113c4087e7df97f213c95af00e Mon Sep 17 00:00:00 2001 From: Frank Zingsheim Date: Tue, 12 Feb 2013 21:16:57 +0100 Subject: [PATCH] Test for #4573 (False positive: variableScope within if/else if) --- test/testother.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 469a1672b..90c3fca9d 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -67,6 +67,7 @@ private: TEST_CASE(varScope12); TEST_CASE(varScope13); // variable usage in inner loop TEST_CASE(varScope14); + TEST_CASE(varScope15); // #4573 if-else-if TEST_CASE(oldStylePointerCast); TEST_CASE(invalidPointerCast); @@ -847,6 +848,18 @@ private: ASSERT_EQUALS("", errout.str()); } + void varScope15() { + // #4573 + varScope("void f() {\n" + " int a,b,c;\n" + " if (a);\n" + " else if(b);\n" + " else if(c);\n" + " else;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void checkOldStylePointerCast(const char code[]) { // Clear the error buffer.. errout.str("");