File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1360,7 +1360,7 @@ void Tokenizer::simplifyTypedef()
13601360 const bool sameStartEnd = (typeStart == typeEnd);
13611361
13621362 // check for derived class: class A : some_typedef {
1363- const bool isDerived = Token::Match (tok2->previous (), " public|protected|private %type% {|," );
1363+ const bool isDerived = Token::Match (tok2->previous (), " public|protected|private|: %type% {|," );
13641364
13651365 // check for cast: (some_typedef) A or static_cast<some_typedef>(A)
13661366 // todo: check for more complicated casts like: (const some_typedef *)A
Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ class TestSimplifyTypedef : public TestFixture {
189189 TEST_CASE (simplifyTypedef140); // #10798
190190 TEST_CASE (simplifyTypedef141); // #10144
191191 TEST_CASE (simplifyTypedef142); // T() when T is a pointer type
192+ TEST_CASE (simplifyTypedef143); // #11506
192193 TEST_CASE (simplifyTypedef144); // #9353
193194
194195 TEST_CASE (simplifyTypedefFunction1);
@@ -3071,6 +3072,16 @@ class TestSimplifyTypedef : public TestFixture {
30713072 ASSERT_EQUALS (" void f ( int * = ( int * ) 0 ) { }" , tok (code2));
30723073 }
30733074
3075+ void simplifyTypedef143 () { // #11506
3076+ const char code[] = " typedef struct { int i; } B;\n "
3077+ " void f() {\n "
3078+ " struct D : B {\n "
3079+ " char c;\n "
3080+ " };\n "
3081+ " }\n " ;
3082+ ASSERT_EQUALS (" struct B { int i ; } ; void f ( ) { struct D : B { char c ; } ; }" , tok (code));
3083+ }
3084+
30743085 void simplifyTypedef144 () { // #9353
30753086 const char code[] = " typedef struct {} X;\n "
30763087 " std::vector<X> v;\n " ;
You can’t perform that action at this time.
0 commit comments