File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8059,7 +8059,7 @@ void Tokenizer::simplifyStructDecl()
80598059 }
80608060
80618061 if (isEnum) {
8062- if (tok->next ()->str () == " {" ) {
8062+ if (tok->next ()->str () == " {" && tok-> next ()-> link () != tok-> tokAt ( 2 ) ) {
80638063 tok->next ()->str (" (" );
80648064 tok->linkAt (1 )->str (" )" );
80658065 }
Original file line number Diff line number Diff line change @@ -2584,9 +2584,16 @@ class TestSimplifyTokens : public TestFixture {
25842584
25852585 void simplifyVarDeclInitLists ()
25862586 {
2587- const char code[] = " std::vector<int> v{a * b, 1};" ;
2588- const char exp[] = " std :: vector < int > v { a * b , 1 } ;" ;
2589- ASSERT_EQUALS (exp, tok (code));
2587+ {
2588+ const char code[] = " std::vector<int> v{a * b, 1};" ;
2589+ const char exp[] = " std :: vector < int > v { a * b , 1 } ;" ;
2590+ ASSERT_EQUALS (exp, tok (code));
2591+ }
2592+ {
2593+ const char code[] = " enum E { E0 } e{};" ;
2594+ const char exp[] = " enum E { E0 } ; enum E e ; e = { } ;" ;
2595+ ASSERT_EQUALS (exp, tok (code));
2596+ }
25902597 }
25912598};
25922599
You can’t perform that action at this time.
0 commit comments