diff --git a/lib/forwardanalyzer.cpp b/lib/forwardanalyzer.cpp index 5c97528372b..0999a08d908 100644 --- a/lib/forwardanalyzer.cpp +++ b/lib/forwardanalyzer.cpp @@ -845,7 +845,7 @@ namespace { return Break(); } else if (Token* callTok = callExpr(tok)) { // TODO: Dont traverse tokens a second time - if (start != callTok && tok != callTok && updateRecursive(callTok->astOperand1()) == Progress::Break) + if (start != callTok && tok != callTok && (tok->str() != "." || tok != callTok->astOperand1()) && updateRecursive(callTok->astOperand1()) == Progress::Break) return Break(); // Since the call could be an unknown macro, traverse the tokens as a range instead of recursively if (!Token::simpleMatch(callTok, "( )") && diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 65f198dcbab..7e4f9f55268 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1077,6 +1077,14 @@ class TestValueFlow : public TestFixture { " }\n" "}\n"; ASSERT_EQUALS(false, testValueOfX(code, 13U, ValueFlow::Value::MoveKind::MovedVariable)); + + code = "struct S { int f(int); };\n" // #11751 + "S g(S);\n" + "void h() {\n" + " S x;\n" + " g(std::move(x)).f(1);\n" + "}\n"; + ASSERT_EQUALS(false, testValueOfX(code, 5U, ValueFlow::Value::MoveKind::MovedVariable)); } void valueFlowCalculations() {