Skip to content

Commit

Permalink
Update testvarid.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed May 7, 2024
1 parent 77b7262 commit 3d41e0f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/testvarid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class TestVarID : public TestFixture {
TEST_CASE(exprid8);
TEST_CASE(exprid9);
TEST_CASE(exprid10);
TEST_CASE(exprid11);

TEST_CASE(structuredBindings);
}
Expand Down Expand Up @@ -4102,6 +4103,26 @@ class TestVarID : public TestFixture {
ASSERT_EQUALS(expected, tokenizeExpr(code));
}

void exprid11()
{
const char* code{}, *exp{};
code = "struct S { void f(); };\n" // #12713
"int g(int, S*);\n"
"int h(void (*)(), S*);\n"
"void S::f() {\n"
" std::make_unique<int>(g({}, this)).release();\n"
" std::make_unique<int>(h([]() {}, this)).release();\n"
"}\n";
exp = "1: struct S { void f ( ) ; } ;\n"
"2: int g ( int , S * ) ;\n"
"3: int h ( void ( * ) ( ) , S * ) ;\n"
"4: void S :: f ( ) {\n"
"5: std ::@UNIQUE make_unique < int > (@UNIQUE g (@UNIQUE { } ,@6 this ) ) .@UNIQUE release (@UNIQUE ) ;\n"
"6: std ::@UNIQUE make_unique < int > (@UNIQUE h (@UNIQUE [ ] ( ) { } ,@6 this ) ) .@UNIQUE release (@UNIQUE ) ;\n"
"7: }\n";
ASSERT_EQUALS(exp, tokenizeExpr(code));
}

void structuredBindings() {
const char code[] = "int foo() { auto [x,y] = xy(); return x+y; }";
ASSERT_EQUALS("1: int foo ( ) { auto [ x@1 , y@2 ] = xy ( ) ; return x@1 + y@2 ; }\n",
Expand Down

0 comments on commit 3d41e0f

Please sign in to comment.