File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1588,7 +1588,8 @@ namespace {
1588
1588
if (op1 && op1->exprId () == 0 )
1589
1589
return ;
1590
1590
const Token* op2 = tok->astParent ()->astOperand2 ();
1591
- if (op2 && op2->exprId () == 0 && !(isLambdaCaptureList (op2) || (op2->str () == " (" && isLambdaCaptureList (op2->astOperand1 ()))))
1591
+ if (op2 && op2->exprId () == 0 &&
1592
+ !(isLambdaCaptureList (op2) || (op2->str () == " (" && isLambdaCaptureList (op2->astOperand1 ())) || Token::simpleMatch (op2, " { }" )))
1592
1593
return ;
1593
1594
1594
1595
if (tok->astParent ()->isExpandedMacro () || Token::Match (tok->astParent (), " ++|--" )) {
Original file line number Diff line number Diff line change @@ -3980,6 +3980,18 @@ class TestVarID : public TestFixture {
3980
3980
const char expected3[] = " 1: struct S { int * p ; } ;\n "
3981
3981
" 2: S f ( ) { return S@UNIQUE {@UNIQUE std ::@UNIQUE make_unique < int > (@UNIQUE [ ] ( ) { return 4 ; } ( ) ) .@UNIQUE release (@UNIQUE ) } ; }\n " ;
3982
3982
ASSERT_EQUALS (expected3, tokenizeExpr (code3));
3983
+
3984
+ const char code4[] = " std::unique_ptr<int> g(int i) { return std::make_unique<int>(i); }\n "
3985
+ " void h(int*);\n "
3986
+ " void f() {\n "
3987
+ " h(g({}).get());\n "
3988
+ " }\n " ;
3989
+ const char expected4[] = " 1: std :: unique_ptr < int > g ( int i ) { return std ::@UNIQUE make_unique < int > (@UNIQUE i@1 ) ; }\n "
3990
+ " 2: void h ( int * ) ;\n "
3991
+ " 3: void f ( ) {\n "
3992
+ " 4: h (@UNIQUE g (@UNIQUE { } ) .@UNIQUE get (@UNIQUE ) ) ;\n "
3993
+ " 5: }\n " ;
3994
+ ASSERT_EQUALS (expected4, tokenizeExpr (code4));
3983
3995
}
3984
3996
3985
3997
void structuredBindings () {
You can’t perform that action at this time.
0 commit comments