parent
77d8eaa2a1
commit
7ac824f38a
|
@ -1588,7 +1588,7 @@ namespace {
|
|||
if (op1 && op1->exprId() == 0)
|
||||
return;
|
||||
const Token* op2 = tok->astParent()->astOperand2();
|
||||
if (op2 && op2->exprId() == 0)
|
||||
if (op2 && op2->exprId() == 0 && !(isLambdaCaptureList(op2) || (op2->str() == "(" && isLambdaCaptureList(op2->astOperand1()))))
|
||||
return;
|
||||
|
||||
if (tok->astParent()->isExpandedMacro() || Token::Match(tok->astParent(), "++|--")) {
|
||||
|
|
|
@ -3968,6 +3968,18 @@ private:
|
|||
"3: ( ( s@1 +=@UNIQUE \"--\"@UNIQUE ) +=@UNIQUE std ::@UNIQUE string (@UNIQUE ) ) +=@UNIQUE \"=\"@UNIQUE ;\n"
|
||||
"4: }\n";
|
||||
ASSERT_EQUALS(expected, tokenizeExpr(code));
|
||||
|
||||
const char code2[] = "struct S { std::function<void()>* p; };\n"
|
||||
"S f() { return S{ std::make_unique<std::function<void()>>([]() {}).release()}; }";
|
||||
const char expected2[] = "1: struct S { std :: function < void ( ) > * p ; } ;\n"
|
||||
"2: S f ( ) { return S@UNIQUE {@UNIQUE std ::@UNIQUE make_unique < std :: function < void ( ) > > (@UNIQUE [ ] ( ) { } ) .@UNIQUE release (@UNIQUE ) } ; }\n";
|
||||
ASSERT_EQUALS(expected2, tokenizeExpr(code2));
|
||||
|
||||
const char code3[] = "struct S { int* p; };\n"
|
||||
"S f() { return S{ std::make_unique<int>([]() { return 4; }()).release()}; }\n";
|
||||
const char expected3[] = "1: struct S { int * p ; } ;\n"
|
||||
"2: S f ( ) { return S@UNIQUE {@UNIQUE std ::@UNIQUE make_unique < int > (@UNIQUE [ ] ( ) { return 4 ; } ( ) ) .@UNIQUE release (@UNIQUE ) } ; }\n";
|
||||
ASSERT_EQUALS(expected3, tokenizeExpr(code3));
|
||||
}
|
||||
|
||||
void structuredBindings() {
|
||||
|
|
Loading…
Reference in New Issue