Fix FN constParameterPointer (#5270)
Co-authored-by: chrchr-github <chrchr@github>
This commit is contained in:
parent
f10851dc37
commit
99f7f88f39
|
@ -2196,7 +2196,7 @@ T* getTokenArgumentFunctionImpl(T* tok, int& argn)
|
|||
parent = parent->astParent();
|
||||
|
||||
// passing variable to subfunction?
|
||||
if (Token::Match(parent, "[(,{]"))
|
||||
if (Token::Match(parent, "[[(,{]"))
|
||||
;
|
||||
else if (Token::simpleMatch(parent, ":")) {
|
||||
while (Token::Match(parent, "[?:]"))
|
||||
|
|
|
@ -3754,6 +3754,13 @@ private:
|
|||
" p = q;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { int a[1]; };\n"
|
||||
"void f(S* s) {\n"
|
||||
" if (s->a[0]) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Parameter 's' can be declared as pointer to const\n",
|
||||
errout.str());
|
||||
}
|
||||
|
||||
void switchRedundantAssignmentTest() {
|
||||
|
|
Loading…
Reference in New Issue