Add test for #9838 / Remove noisy assert (#4059)

* Add test for #9838

* Remove noisy assert
This commit is contained in:
chrchr-github 2022-04-28 15:24:54 +02:00 committed by GitHub
parent aafd1e10be
commit 3d3885d151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -2182,8 +2182,6 @@ bool Token::addValue(const ValueFlow::Value &value)
// Add value
if (it == mImpl->mValues->end()) {
// If the errorPath has gotten this large then there must be something wrong
assert(value.errorPath.size() < 64);
ValueFlow::Value v(value);
if (v.varId == 0)
v.varId = mImpl->mVarId;

View File

@ -728,6 +728,15 @@ private:
" }\n"
"};\n", /*cpp*/ true);
ASSERT_EQUALS("", errout.str());
check("int g(int *p) {\n" // #9838
" std::unique_ptr<int> temp(p);\n"
" return DoSomething(p);\n"
"}\n"
"int f() {\n"
" return g(new int(3));\n"
"}\n", /*cpp*/ true);
ASSERT_EQUALS("", errout.str());
}
void doublefree1() { // #3895