#6671 false positive: incorrect sizeofwithsilentarraypointer with reference to array.
This commit is contained in:
parent
97f998e6dd
commit
1c5e9e47c5
|
@ -78,7 +78,7 @@ void CheckSizeof::checkSizeofForArrayParameter()
|
|||
}
|
||||
|
||||
const Variable *var = varTok->variable();
|
||||
if (var && var->isArray() && var->isArgument())
|
||||
if (var && var->isArray() && var->isArgument() && !var->isReference())
|
||||
sizeofForArrayParameterError(tok);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,6 +181,14 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:2]: (warning) Using 'sizeof' on array given as "
|
||||
"function argument returns size of a pointer.\n", errout.str());
|
||||
|
||||
check("typedef char Fixname[1000];\n"
|
||||
"int f2(Fixname& f2v) {\n"
|
||||
" int i = sizeof(f2v);\n"
|
||||
" printf(\"sizeof f2v %d\n\", i);\n"
|
||||
" }\n"
|
||||
);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(int *p) {\n"
|
||||
" p[0] = 0;\n"
|
||||
" int unused = sizeof(p);\n"
|
||||
|
|
Loading…
Reference in New Issue