File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -3386,12 +3386,7 @@ bool Tokenizer::simplifyUsing()
33863386 Token *usingStart = it->startTok ;
33873387 Token *usingEnd = it->endTok ;
33883388 if (usingStart->previous ()) {
3389- if (usingEnd->next ())
3390- Token::eraseTokens (usingStart->previous (), usingEnd->next ());
3391- else {
3392- Token::eraseTokens (usingStart->previous (), usingEnd);
3393- usingEnd->deleteThis ();
3394- }
3389+ Token::eraseTokens (usingStart->previous (), usingEnd->next ());
33953390 } else {
33963391 if (usingEnd->next ()) {
33973392 Token::eraseTokens (usingStart, usingEnd->next ());
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ class TestSimplifyUsing : public TestFixture {
7474 TEST_CASE (simplifyUsing32);
7575 TEST_CASE (simplifyUsing33);
7676 TEST_CASE (simplifyUsing34);
77+ TEST_CASE (simplifyUsing35);
7778
7879 TEST_CASE (simplifyUsing8970);
7980 TEST_CASE (simplifyUsing8971);
@@ -854,6 +855,14 @@ class TestSimplifyUsing : public TestFixture {
854855 ASSERT_EQUALS (" " , errout_str ());
855856 }
856857
858+ void simplifyUsing35 () { // #13492
859+ const char code[] = " using a = b;\n "
860+ " using c = d;\n " ;
861+ const char expected[] = " ;" ;
862+ ASSERT_EQUALS (expected, tok (code));
863+ ASSERT_EQUALS (" " , errout_str ());
864+ }
865+
857866 void simplifyUsing8970 () {
858867 const char code[] = " using V = std::vector<int>;\n "
859868 " struct A {\n "
You can’t perform that action at this time.
0 commit comments