Fixed #9434 (False positive: Out of bounds access when using const pointer)
This commit is contained in:
parent
88a3b4c685
commit
a241be0ecc
|
@ -5423,7 +5423,9 @@ static bool isContainerSizeChangedByFunction(const Token *tok, int depth = 20)
|
||||||
if (arg) {
|
if (arg) {
|
||||||
if (!arg->isReference() && !addressOf)
|
if (!arg->isReference() && !addressOf)
|
||||||
return false;
|
return false;
|
||||||
if (arg->isConst())
|
if (!addressOf && arg->isConst())
|
||||||
|
return false;
|
||||||
|
if (arg->valueType() && arg->valueType()->constness == 1)
|
||||||
return false;
|
return false;
|
||||||
const Scope * scope = fun->functionScope;
|
const Scope * scope = fun->functionScope;
|
||||||
if (scope) {
|
if (scope) {
|
||||||
|
|
|
@ -4077,6 +4077,14 @@ private:
|
||||||
"}";
|
"}";
|
||||||
ASSERT(tokenValues(code, "x . front").empty());
|
ASSERT(tokenValues(code, "x . front").empty());
|
||||||
|
|
||||||
|
code = "void g(std::list<int>* const);\n" // #9434
|
||||||
|
"void f() {\n"
|
||||||
|
" std::list<int> x;\n"
|
||||||
|
" g(&x);\n"
|
||||||
|
" x.front();\n"
|
||||||
|
"}";
|
||||||
|
ASSERT(tokenValues(code, "x . front").empty());
|
||||||
|
|
||||||
code = "void g(const std::list<int>&);\n"
|
code = "void g(const std::list<int>&);\n"
|
||||||
"void f() {\n"
|
"void f() {\n"
|
||||||
" std::list<int> x;\n"
|
" std::list<int> x;\n"
|
||||||
|
|
Loading…
Reference in New Issue