From 3d41e0f5df9645eb7bb148ed695474d44c469dfc Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 7 May 2024 11:18:58 +0200 Subject: [PATCH] Update testvarid.cpp --- test/testvarid.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 47a782475b0..b84878868b6 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -247,6 +247,7 @@ class TestVarID : public TestFixture { TEST_CASE(exprid8); TEST_CASE(exprid9); TEST_CASE(exprid10); + TEST_CASE(exprid11); TEST_CASE(structuredBindings); } @@ -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(g({}, this)).release();\n" + " std::make_unique(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",