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 @@ -10080,14 +10080,7 @@ void Tokenizer::simplifyBitfields()
1008010080
1008110081 bool isEnum = false ;
1008210082 if (tok->str () == " }" ) {
10083- const Token *type = tok->link ()->previous ();
10084- while (type && type->isName ()) {
10085- if (type->str () == " enum" ) {
10086- isEnum = true ;
10087- break ;
10088- }
10089- type = type->previous ();
10090- }
10083+ isEnum = isEnumStart (tok->link ());
1009110084 }
1009210085
1009310086 const auto tooLargeError = [this ](const Token *tok) {
Original file line number Diff line number Diff line change @@ -4939,6 +4939,20 @@ class TestTokenizer : public TestFixture {
49394939 tokenizeAndStringify (" struct AB {\n "
49404940 " enum Foo {A,B} foo : 4;\n "
49414941 " };" ));
4942+
4943+ ASSERT_EQUALS (" struct S {\n " // #14324
4944+ " enum E : int { E0 , E1 } ; enum E e ;\n "
4945+ " } ;" ,
4946+ tokenizeAndStringify (" struct S {\n "
4947+ " enum E : int { E0, E1 } e : 2;\n "
4948+ " };\n " ));
4949+
4950+ ASSERT_EQUALS (" struct S {\n "
4951+ " enum class E : std :: uint8_t { E0 , E1 } ; enum E e ;\n "
4952+ " } ;" ,
4953+ tokenizeAndStringify (" struct S {\n "
4954+ " enum class E : std::uint8_t { E0, E1 } e : 2;\n "
4955+ " };\n " ));
49424956 }
49434957
49444958 void bitfields16 () {
You can’t perform that action at this time.
0 commit comments