Fixed #8419 (False positive accessMoved on int)
This commit is contained in:
parent
3b3016f49e
commit
fe23d017f3
|
@ -3923,7 +3923,8 @@ static bool isStdMoveOrStdForwarded(Token * tok, ValueFlow::Value::MoveKind * mo
|
|||
return false;
|
||||
if (variableToken->strAt(2) == ".") // Only partially moved
|
||||
return false;
|
||||
|
||||
if (variableToken->valueType() && variableToken->valueType()->type >= ValueType::Type::VOID)
|
||||
return false;
|
||||
if (moveKind != nullptr)
|
||||
*moveKind = kind;
|
||||
if (varTok != nullptr)
|
||||
|
|
|
@ -561,6 +561,12 @@ private:
|
|||
" X y=x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 11U, ValueFlow::Value::MoveKind::MovedVariable));
|
||||
|
||||
code = "void f(int x) {\n"
|
||||
" g(std::move(x));\n"
|
||||
" y=x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 3U, ValueFlow::Value::MoveKind::MovedVariable));
|
||||
}
|
||||
|
||||
void valueFlowCalculations() {
|
||||
|
|
Loading…
Reference in New Issue