File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2080,8 +2080,8 @@ void Tokenizer::simplifyTypedefCpp()
2080
2080
// cppcheck-suppress useStlAlgorithm
2081
2081
tok2 = simplifyTypedefInsertToken(tok2, p, location);
2082
2082
if (constTok) {
2083
- constTok->deleteThis();
2084
2083
tok2 = simplifyTypedefInsertToken(tok2, "const", location);
2084
+ constTok->deleteThis();
2085
2085
}
2086
2086
}
2087
2087
Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ class TestSimplifyTypedef : public TestFixture {
245
245
246
246
TEST_CASE (simplifyTypedefTokenColumn1);
247
247
TEST_CASE (simplifyTypedefTokenColumn2);
248
+ TEST_CASE (simplifyTypedefTokenColumn3);
248
249
249
250
TEST_CASE (typedefInfo1);
250
251
@@ -4493,6 +4494,14 @@ class TestSimplifyTypedef : public TestFixture {
4493
4494
ASSERT_EQUALS (5 , type->column ());
4494
4495
}
4495
4496
4497
+ void simplifyTypedefTokenColumn3 () { // #13368
4498
+ const char code[] = " typedef struct S_ {} S;\n "
4499
+ " typedef S* P;\n "
4500
+ " void f(const P p);\n " ;
4501
+ ASSERT_EQUALS (" struct S_ { } ; void f ( struct S_ * const p ) ;" , // don't crash
4502
+ tok (code));
4503
+ }
4504
+
4496
4505
void typedefInfo1 () {
4497
4506
const std::string xml = dumpTypedefInfo (" typedef int A;\n A x;" );
4498
4507
ASSERT_EQUALS (" <typedef-info>\n "
You can’t perform that action at this time.
0 commit comments