File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,6 +199,7 @@ class TestClass : public TestFixture {
199199 TEST_CASE (const100);
200200 TEST_CASE (const101);
201201 TEST_CASE (const102);
202+ TEST_CASE (const103);
202203
203204 TEST_CASE (const_handleDefaultParameters);
204205 TEST_CASE (const_passThisToMemberOfOtherClass);
@@ -7045,6 +7046,15 @@ class TestClass : public TestFixture {
70457046 errout_str ());
70467047 }
70477048
7049+ void const103 () {
7050+ checkConst (" constexpr int BITS{4};\n "
7051+ " struct Struct {\n "
7052+ " unsigned int data() const { return m_data; }\n "
7053+ " unsigned int m_data : BITS;\n "
7054+ " };\n " );
7055+ ASSERT_EQUALS (" " , errout_str ());
7056+ }
7057+
70487058 void const_handleDefaultParameters () {
70497059 checkConst (" struct Foo {\n "
70507060 " void foo1(int i, int j = 0) {\n "
Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ class TestTokenizer : public TestFixture {
342342 TEST_CASE (bitfields19); // ticket #13733
343343 TEST_CASE (bitfields20);
344344 TEST_CASE (bitfields21);
345+ TEST_CASE (bitfields22);
345346
346347 TEST_CASE (simplifyNamespaceStd);
347348
@@ -5371,6 +5372,14 @@ class TestTokenizer : public TestFixture {
53715372 ASSERT_EQUALS (1 , b->bits ());
53725373 }
53735374
5375+ void bitfields22 () {
5376+ const char code[] = " constexpr int BITS{4};\n "
5377+ " struct Struct { unsigned int m_data : BITS; };\n " ;
5378+ const char expected[] = " constexpr int BITS { 4 } ;\n "
5379+ " struct Struct { unsigned int m_data ; } ;" ;
5380+ ASSERT_EQUALS (expected, tokenizeAndStringify (code));
5381+ }
5382+
53745383 void simplifyNamespaceStd () {
53755384 const char *expected;
53765385
You can’t perform that action at this time.
0 commit comments