Fixed #7092 (Invalid style error: Variable not assigned a value)
This commit is contained in:
parent
ccb2f2ce6a
commit
b8ee500d45
|
@ -718,7 +718,7 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
|
|||
else if (i->isArray() && i->nameToken()->previous()->str() == "&")
|
||||
type = Variables::referenceArray;
|
||||
else if (i->isArray())
|
||||
type = Variables::array;
|
||||
type = (i->dimensions().size() == 1U) ? Variables::array : Variables::pointerArray;
|
||||
else if (i->isReference())
|
||||
type = Variables::reference;
|
||||
else if (i->nameToken()->previous()->str() == "*" && i->nameToken()->strAt(-2) == "*")
|
||||
|
|
|
@ -125,6 +125,7 @@ private:
|
|||
TEST_CASE(localvararray2); // ticket #3438
|
||||
TEST_CASE(localvararray3); // ticket #3980
|
||||
TEST_CASE(localvararray4); // ticket #4839
|
||||
TEST_CASE(localvararray5); // ticket #7092
|
||||
TEST_CASE(localvarstring1);
|
||||
TEST_CASE(localvarstring2); // ticket #2929
|
||||
TEST_CASE(localvarconst1);
|
||||
|
@ -3726,6 +3727,14 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvararray5() {
|
||||
functionVariableUsage("int foo() {\n"
|
||||
" int p[5][5];\n"
|
||||
" dostuff(*p);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvarstring1() { // ticket #1597
|
||||
functionVariableUsage("void foo() {\n"
|
||||
" std::string s;\n"
|
||||
|
|
Loading…
Reference in New Issue