File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2079,7 +2079,7 @@ void Tokenizer::simplifyTypedefCpp()
20792079 for (const std::string &p : pointers)
20802080 // cppcheck-suppress useStlAlgorithm
20812081 tok2 = simplifyTypedefInsertToken (tok2, p, location);
2082- if (constTok) {
2082+ if (constTok && !functionPtr ) {
20832083 tok2 = simplifyTypedefInsertToken (tok2, " const" , location);
20842084 constTok->deleteThis ();
20852085 }
Original file line number Diff line number Diff line change @@ -4500,6 +4500,12 @@ class TestSimplifyTypedef : public TestFixture {
45004500 " void f(const P p);\n " ;
45014501 ASSERT_EQUALS (" struct S_ { } ; void f ( struct S_ * const p ) ;" , // don't crash
45024502 tok (code));
4503+
4504+ const char code2[] = " struct S;\n "
4505+ " typedef S& (S::* P)(const S&);\n "
4506+ " void f(const P);\n " ;
4507+ ASSERT_EQUALS (" struct S ; void f ( const S & ( S :: * ) ( const S & ) ) ;" , // don't crash
4508+ tok (code2));
45034509 }
45044510
45054511 void typedefInfo1 () {
You can’t perform that action at this time.
0 commit comments