Fix 10589: False positive: danglingLifetime for moved unique ptr (#3547)
This commit is contained in:
parent
f5f600bafc
commit
6338c2396c
|
@ -2515,6 +2515,8 @@ struct SingleValueFlowAnalyzer : ValueFlowAnalyzer {
|
|||
{
|
||||
if (value.isUninitValue())
|
||||
return false;
|
||||
if (value.isLifetimeValue())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2465,6 +2465,15 @@ private:
|
|||
"}\n",
|
||||
true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct A {\n"
|
||||
" std::vector<std::unique_ptr<int>> mA;\n"
|
||||
" void f(std::unique_ptr<int> a) {\n"
|
||||
" auto x = a.get();\n"
|
||||
" mA.push_back(std::move(a));\n"
|
||||
" }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void danglingLifetimeContainerView()
|
||||
|
|
Loading…
Reference in New Issue