diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 37c76de4eaa..bdb1e75d42e 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -214,6 +214,7 @@ class TestSimplifyTypedef : public TestFixture { TEST_CASE(simplifyTypedef147); TEST_CASE(simplifyTypedef148); TEST_CASE(simplifyTypedef149); + TEST_CASE(simplifyTypedef150); TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction2); // ticket #1685 @@ -3511,6 +3512,26 @@ class TestSimplifyTypedef : public TestFixture { "}\n"; ASSERT_EQUALS("namespace N { enum E { } ; } void g ( int ) ; void f ( ) { g ( sizeof ( enum N :: E ) ) ; }", tok(code)); } + + void simplifyTypedef150() { // #12475 + const char* code{}, *exp{}; + code = "struct S {\n" + " std::vector const& h(int);\n" + "};\n" + "void g(auto, int);\n" + "void f() {\n" + " typedef std::vector const& (S::* func_t)(int);\n" + " g(func_t(&S::h), 5);\n" + "}\n"; + exp = "struct S { " + "const std :: vector < int > & h ( int ) ; " + "} ; " + "void g ( auto , int ) ; " + "void f ( ) { " + "g ( const std :: vector < int > & ( S :: * ( & S :: h ) ) ( int ) , 5 ) ; " + "}"; + ASSERT_EQUALS(exp, tok(code)); // TODO: don't create invalid code + } void simplifyTypedefFunction1() { { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index b5a175fa919..4fbb7fe2d99 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6587,6 +6587,7 @@ class TestTokenizer : public TestFixture { ASSERT_EQUALS("x{( forbc;;(", testAst("x({ for(a;b;c){} });")); ASSERT_EQUALS("PT.(", testAst("P->~T();")); // <- The "T" token::function() will be a destructor ASSERT_EQUALS("double&(4[", testAst("void f(double(&)[4]) {}")); + ASSERT_EQUALS("voidu*", testAst("int* g ( void* (f) (void*), void* u);")); // #12475 } void asttemplate() { // uninstantiated templates will have <,>,etc..