Test for #4573 (False positive: variableScope within if/else if)

This commit is contained in:
Frank Zingsheim 2013-02-12 21:16:57 +01:00
parent 1e550f9fdf
commit 75f69c11b7
1 changed files with 13 additions and 0 deletions

View File

@ -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("");