@@ -437,6 +437,7 @@ class TestTokenizer : public TestFixture {
437437 TEST_CASE (astenumdecl);
438438 TEST_CASE (astcompound);
439439 TEST_CASE (astfuncdecl);
440+ TEST_CASE (astarrayinit);
440441
441442 TEST_CASE (startOfExecutableScope);
442443
@@ -7492,6 +7493,11 @@ class TestTokenizer : public TestFixture {
74927493 ASSERT_EQUALS (" " , testAst (" ::int32_t f();" ));
74937494 }
74947495
7496+ void astarrayinit () { // #11738
7497+ ASSERT_EQUALS (" a2[12,{" , testAst (" int a[2]{ 1, 2 };" ));
7498+ ASSERT_EQUALS (" a2[2[ 12, 34,{" , testAst (" int a[2][2]{ { 1, 2 }, { 3, 4 } };" ));
7499+ }
7500+
74957501#define isStartOfExecutableScope (offset, code ) isStartOfExecutableScope_(offset, code, __FILE__, __LINE__)
74967502 template <size_t size>
74977503 bool isStartOfExecutableScope_ (int offset, const char (&code)[size], const char* file, int line) {
@@ -8641,6 +8647,10 @@ class TestTokenizer : public TestFixture {
86418647 " { 1" ,
86428648 Token::Cpp11init::CPP11INIT);
86438649
8650+ testIsCpp11init (" int a[2]{ 1, 2 }; \n " ,
8651+ " { 1" ,
8652+ Token::Cpp11init::CPP11INIT);
8653+
86448654 ASSERT_NO_THROW (tokenizeAndStringify (" template<typename U> struct X {};\n " // don't crash
86458655 " template<typename T> auto f(T t) -> X<decltype(t + 1)> {}\n " ));
86468656 ASSERT_EQUALS (" [test.cpp:2:22]: (debug) auto token with no type. [autoNoType]\n " , errout_str ());
0 commit comments