File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -10087,14 +10087,7 @@ void Tokenizer::simplifyBitfields()
1008710087
1008810088 bool isEnum = false ;
1008910089 if (tok->str () == " }" ) {
10090- const Token *type = tok->link ()->previous ();
10091- while (type && type->isName ()) {
10092- if (type->str () == " enum" ) {
10093- isEnum = true ;
10094- break ;
10095- }
10096- type = type->previous ();
10097- }
10090+ isEnum = isEnumStart (tok->link ());
1009810091 }
1009910092
1010010093 const auto tooLargeError = [this ](const Token *tok) {
Original file line number Diff line number Diff line change @@ -4943,6 +4943,20 @@ class TestTokenizer : public TestFixture {
49434943 tokenizeAndStringify (" struct AB {\n "
49444944 " enum Foo {A,B} foo : 4;\n "
49454945 " };" ));
4946+
4947+ ASSERT_EQUALS (" struct S {\n " // #14324
4948+ " enum E : int { E0 , E1 } ; enum E e ;\n "
4949+ " } ;" ,
4950+ tokenizeAndStringify (" struct S {\n "
4951+ " enum E : int { E0, E1 } e : 2;\n "
4952+ " };\n " ));
4953+
4954+ ASSERT_EQUALS (" struct S {\n "
4955+ " enum class E : std :: uint8_t { E0 , E1 } ; enum E e ;\n "
4956+ " } ;" ,
4957+ tokenizeAndStringify (" struct S {\n "
4958+ " enum class E : std::uint8_t { E0, E1 } e : 2;\n "
4959+ " };\n " ));
49464960 }
49474961
49484962 void bitfields16 () {
You can’t perform that action at this time.
0 commit comments