parent
9f96803f62
commit
f037edf586
|
@ -5085,7 +5085,7 @@ static const Token * findEndOfFunctionCallForParameter(const Token * parameterTo
|
|||
if (!parameterToken)
|
||||
return nullptr;
|
||||
const Token * parent = parameterToken->astParent();
|
||||
while (parent && !parent->isOp() && parent->str() != "(")
|
||||
while (parent && !parent->isOp() && !Token::Match(parent, "[({]"))
|
||||
parent = parent->astParent();
|
||||
if (!parent)
|
||||
return nullptr;
|
||||
|
|
|
@ -248,6 +248,7 @@ private:
|
|||
TEST_CASE(doubleMoveMemberInitialization1);
|
||||
TEST_CASE(doubleMoveMemberInitialization2);
|
||||
TEST_CASE(doubleMoveMemberInitialization3); // #9974
|
||||
TEST_CASE(doubleMoveMemberInitialization4);
|
||||
TEST_CASE(moveAndAssign1);
|
||||
TEST_CASE(moveAndAssign2);
|
||||
TEST_CASE(moveAssignMoveAssign);
|
||||
|
@ -10503,6 +10504,16 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void doubleMoveMemberInitialization4() { // #11440
|
||||
check("struct S { void f(int); };\n"
|
||||
"struct T {\n"
|
||||
" T(int c, S&& d) : c{ c }, d{ std::move(d) } { d.f(c); }\n"
|
||||
" int c;\n"
|
||||
" S d;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (warning, inconclusive) Access of moved variable 'd'.\n", errout.str());
|
||||
}
|
||||
|
||||
void moveAndAssign1() {
|
||||
check("A g(A a);\n"
|
||||
"void f() {\n"
|
||||
|
|
Loading…
Reference in New Issue