Fix issue 10002: False positive: constParameter with reference to pointer (#2918)

This commit is contained in:
Paul Fultz II 2020-11-22 01:47:24 -06:00 committed by GitHub
parent bf00d521d7
commit 4a8a78a925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -1361,6 +1361,8 @@ void CheckOther::checkConstVariable()
continue;
if (var->isRValueReference())
continue;
if (var->isPointer())
continue;
if (var->isConst())
continue;
if (!var->scope())

View File

@ -2305,6 +2305,13 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
// #10002
check("using A = int*;\n"
"void f(const A& x) {\n"
" ++(*x);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("void e();\n"
"void g(void);\n"
"void h(void);\n"