From cb974c6e401de0fd43a609a1df115f49af2e6c7b Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Wed, 19 Nov 2025 23:42:41 -0800 Subject: [PATCH 01/12] Fix #21817 add ,...] for array element default initialization --- compiler/include/dmd/init.h | 5 +++-- compiler/src/dmd/astbase.d | 4 +++- compiler/src/dmd/init.d | 3 ++- compiler/src/dmd/initsem.d | 5 +++++ compiler/src/dmd/parse.d | 11 +++++++++++ compiler/test/fail_compilation/array1.d | 14 ++++++++++++++ 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 compiler/test/fail_compilation/array1.d diff --git a/compiler/include/dmd/init.h b/compiler/include/dmd/init.h index 142af9c73619..be80077e6bb8 100644 --- a/compiler/include/dmd/init.h +++ b/compiler/include/dmd/init.h @@ -84,9 +84,10 @@ class ArrayInitializer final : public Initializer public: Expressions index; // indices Initializers value; // of Initializer *'s - unsigned dim; // length of array being initialized Type *type; // type that array will be used to initialize - d_bool isCarray; // C array semantics + unsigned dim; // length of array being initialized + d_bool isCarray; // C array semantics + d_bool defaultInitialze; // ends with `,...]` meaning "default initialize the rest" bool isAssociativeArray() const; diff --git a/compiler/src/dmd/astbase.d b/compiler/src/dmd/astbase.d index 77f7e5b1d8e9..0df594afcdca 100644 --- a/compiler/src/dmd/astbase.d +++ b/compiler/src/dmd/astbase.d @@ -6526,8 +6526,10 @@ struct ASTBase { Expressions index; Initializers value; - uint dim; Type type; + uint dim; + bool isCarray; + bool defaultInitialize; extern (D) this(Loc loc) { diff --git a/compiler/src/dmd/init.d b/compiler/src/dmd/init.d index 9a118bb3d658..a466021058da 100644 --- a/compiler/src/dmd/init.d +++ b/compiler/src/dmd/init.d @@ -175,9 +175,10 @@ extern (C++) final class ArrayInitializer : Initializer { Expressions index; // indices Initializers value; // of Initializer *'s - uint dim; // length of array being initialized Type type; // type that array will be used to initialize + uint dim; // length of array being initialized bool isCarray; // C array semantics + bool defaultInitialize; // ends with `,...]` meaning "default initialize the rest" extern (D) this(Loc loc) { diff --git a/compiler/src/dmd/initsem.d b/compiler/src/dmd/initsem.d index b3cf9933a9df..e3499147e05c 100644 --- a/compiler/src/dmd/initsem.d +++ b/compiler/src/dmd/initsem.d @@ -320,6 +320,11 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn else { ulong edim = tsa.dim.toInteger(); + if (i.dim < edim && !i.defaultInitialize && !i.isCarray) + { + error(i.loc, "insufficient array initializers - has %u elements, but needs %llu", i.dim, edim); + return err(); + } if (i.dim > edim) { error(i.loc, "array initializer has %u elements, but array length is %llu", i.dim, edim); diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d index 81dac5c5d8ae..d5f709e1dbc1 100644 --- a/compiler/src/dmd/parse.d +++ b/compiler/src/dmd/parse.d @@ -7012,6 +7012,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer */ private AST.Initializer parseInitializer() { + //printf("parseInitializer()\n"); const loc = token.loc; switch (token.value) @@ -7086,6 +7087,16 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer commaExpected = true; continue; + case TOK.dotDotDot: + if (commaExpected) + { + error("comma expected before `...]`"); + } + ia.defaultInitialize = true; + nextToken(); + check(TOK.rightBracket); + break; + case TOK.leftCurly: case TOK.leftBracket: if (commaExpected) diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d new file mode 100644 index 000000000000..5fc9f884e889 --- /dev/null +++ b/compiler/test/fail_compilation/array1.d @@ -0,0 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/array1.d(13): Error: insufficient array initializers - has 3 elements, but needs 4 +--- +*/ +extern (C) immutable int[4] a = [1,2,3,...]; +static assert(a[3] == 0); + +immutable int[4] b = [1,2,3,...]; +static assert(b[3] == 0); + +immutable int[4] c = [1,2,3]; + From 0eb3a8c9d1c18a2a64a4262730935638db7969b3 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 1 May 2026 16:21:59 +0100 Subject: [PATCH 02/12] Tweak error, require 2024 edition --- compiler/src/dmd/initsem.d | 6 ++++-- compiler/test/fail_compilation/array1.d | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/src/dmd/initsem.d b/compiler/src/dmd/initsem.d index e3499147e05c..93264bbacee3 100644 --- a/compiler/src/dmd/initsem.d +++ b/compiler/src/dmd/initsem.d @@ -320,9 +320,11 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn else { ulong edim = tsa.dim.toInteger(); - if (i.dim < edim && !i.defaultInitialize && !i.isCarray) + if (i.dim < edim && !i.defaultInitialize && !i.isCarray && + sc.hasEdition(Edition.v2024)) { - error(i.loc, "insufficient array initializers - has %u elements, but needs %llu", i.dim, edim); + error(i.loc, "missing element in array initializer - got %u elements, need %llu", i.dim, edim); + errorSupplemental(i.loc, "use `, ...]` if intentional"); return err(); } if (i.dim > edim) diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d index 5fc9f884e889..92938998c0cc 100644 --- a/compiler/test/fail_compilation/array1.d +++ b/compiler/test/fail_compilation/array1.d @@ -1,9 +1,13 @@ /* TEST_OUTPUT: --- -fail_compilation/array1.d(13): Error: insufficient array initializers - has 3 elements, but needs 4 +fail_compilation/array1.d(17): Error: missing element in array initializer - got 3 elements, need 4 +fail_compilation/array1.d(17): use `, ...]` if intentional --- */ + +module m 2024; + extern (C) immutable int[4] a = [1,2,3,...]; static assert(a[3] == 0); From 825ae9e80c89f125eac4df6d51a07900cbe7952a Mon Sep 17 00:00:00 2001 From: Dennis Korpel Date: Fri, 5 Sep 2025 14:32:01 +0200 Subject: [PATCH 03/12] Fix 21817 - static array accepts incomplete initialization --- compiler/src/dmd/initsem.d | 2 ++ druntime/src/core/sys/windows/winsock2.d | 2 +- druntime/src/core/sys/windows/winver.d | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/src/dmd/initsem.d b/compiler/src/dmd/initsem.d index 93264bbacee3..061a0b421107 100644 --- a/compiler/src/dmd/initsem.d +++ b/compiler/src/dmd/initsem.d @@ -251,11 +251,13 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn } i.type = t; length = 0; + bool hasIndices = false; for (size_t j = 0; j < i.index.length; j++) // don't replace with foreach; j is modified { Expression idx = i.index[j]; if (idx) { + hasIndices = true; sc = sc.startCTFE(); idx = idx.expressionSemantic(sc); sc = sc.endCTFE(); diff --git a/druntime/src/core/sys/windows/winsock2.d b/druntime/src/core/sys/windows/winsock2.d index c2cc1864e1d8..09092d1a6d91 100644 --- a/druntime/src/core/sys/windows/winsock2.d +++ b/druntime/src/core/sys/windows/winsock2.d @@ -637,7 +637,7 @@ union in6_addr } -enum in6_addr IN6ADDR_ANY = { s6_addr8: [0] }; +enum in6_addr IN6ADDR_ANY = { s6_addr8: 0 }; enum in6_addr IN6ADDR_LOOPBACK = { s6_addr8: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] }; //alias IN6ADDR_ANY_INIT = IN6ADDR_ANY; //alias IN6ADDR_LOOPBACK_INIT = IN6ADDR_LOOPBACK; diff --git a/druntime/src/core/sys/windows/winver.d b/druntime/src/core/sys/windows/winver.d index 5ef0864c4405..e1b1618d3a32 100644 --- a/druntime/src/core/sys/windows/winver.d +++ b/druntime/src/core/sys/windows/winver.d @@ -256,7 +256,7 @@ VERSIONHELPERAPI IsWindows10OrGreater() VERSIONHELPERAPI IsWindowsServer() { - OSVERSIONINFOEXW osvi = { OSVERSIONINFOEXW.sizeof, 0, 0, 0, 0, [0], 0, 0, 0, VER_NT_WORKSTATION }; + OSVERSIONINFOEXW osvi = { OSVERSIONINFOEXW.sizeof, 0, 0, 0, 0, 0, 0, 0, 0, VER_NT_WORKSTATION }; const DWORDLONG dwlConditionMask = VerSetConditionMask( 0, VER_PRODUCT_TYPE, VER_EQUAL ); return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); From be8ccd9397e8ff349f64670fc05655d4f5fc67a4 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 1 May 2026 16:36:45 +0100 Subject: [PATCH 04/12] Allow with indices; change to deprecation --- compiler/src/dmd/initsem.d | 8 ++++---- compiler/test/fail_compilation/array1.d | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/src/dmd/initsem.d b/compiler/src/dmd/initsem.d index 061a0b421107..45a75c2c8ac5 100644 --- a/compiler/src/dmd/initsem.d +++ b/compiler/src/dmd/initsem.d @@ -322,12 +322,12 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn else { ulong edim = tsa.dim.toInteger(); - if (i.dim < edim && !i.defaultInitialize && !i.isCarray && + if (i.dim < edim && !i.defaultInitialize && !i.isCarray && !hasIndices && sc.hasEdition(Edition.v2024)) { - error(i.loc, "missing element in array initializer - got %u elements, need %llu", i.dim, edim); - errorSupplemental(i.loc, "use `, ...]` if intentional"); - return err(); + deprecation(i.loc, "array initializer has %u elements, but array length is %llu", i.dim, edim); + deprecationSupplemental(i.loc, "use `, ...]` if intentional"); + //return err(); } if (i.dim > edim) { diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d index 92938998c0cc..7b384277e782 100644 --- a/compiler/test/fail_compilation/array1.d +++ b/compiler/test/fail_compilation/array1.d @@ -1,8 +1,9 @@ /* +REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/array1.d(17): Error: missing element in array initializer - got 3 elements, need 4 -fail_compilation/array1.d(17): use `, ...]` if intentional +fail_compilation/array1.d(18): Deprecation: array initializer has 3 elements, but array length is 4 +fail_compilation/array1.d(18): use `, ...]` if intentional --- */ @@ -15,4 +16,5 @@ immutable int[4] b = [1,2,3,...]; static assert(b[3] == 0); immutable int[4] c = [1,2,3]; +immutable int[4] d = [1:1]; // OK From b2e44178be507f1d373df0bea07f9ea24917c36c Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 1 May 2026 16:39:52 +0100 Subject: [PATCH 05/12] can only use `...` in static array initializer --- compiler/src/dmd/initsem.d | 5 +++++ compiler/test/fail_compilation/array1.d | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/src/dmd/initsem.d b/compiler/src/dmd/initsem.d index 45a75c2c8ac5..4ef6b4a51e0e 100644 --- a/compiler/src/dmd/initsem.d +++ b/compiler/src/dmd/initsem.d @@ -336,6 +336,11 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn } } } + else if (i.defaultInitialize) + { + error(i.loc, "can only use `...` in static array initializer"); + return err(); + } if (errors) return err(); diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d index 7b384277e782..fe19ba945b86 100644 --- a/compiler/test/fail_compilation/array1.d +++ b/compiler/test/fail_compilation/array1.d @@ -2,8 +2,9 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/array1.d(18): Deprecation: array initializer has 3 elements, but array length is 4 -fail_compilation/array1.d(18): use `, ...]` if intentional +fail_compilation/array1.d(19): Deprecation: array initializer has 3 elements, but array length is 4 +fail_compilation/array1.d(19): use `, ...]` if intentional +fail_compilation/array1.d(22): Error: can only use `...` in static array initializer --- */ @@ -18,3 +19,4 @@ static assert(b[3] == 0); immutable int[4] c = [1,2,3]; immutable int[4] d = [1:1]; // OK +int[] e = [1,...]; From 35ea28f15d5c767b9ff6f81c1f7d1ad8761c7367 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 1 May 2026 16:49:56 +0100 Subject: [PATCH 06/12] Test use in default edition --- compiler/test/runnable/b20890.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/test/runnable/b20890.d b/compiler/test/runnable/b20890.d index 9b208da3f772..033f700e6959 100644 --- a/compiler/test/runnable/b20890.d +++ b/compiler/test/runnable/b20890.d @@ -30,11 +30,12 @@ void format8(string spec, S8[1] s) assert (spec == "lengthy"); assert (s[0].m == 42); } -struct S42 { ubyte[42] m = [42]; } +struct S42 { ubyte[42] m = [42, ...]; } void format42(string spec, S42[1] s) { assert (spec == "lengthy"); assert (s[0].m[0] == 42); + assert (s[0].m[1] == 0); } void main() From f4d771552fa6d86088e54f1017aaae2df53195a1 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 1 May 2026 16:50:28 +0100 Subject: [PATCH 07/12] cannot use both indices and `...` --- compiler/src/dmd/initsem.d | 5 +++++ compiler/test/fail_compilation/array1.d | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/compiler/src/dmd/initsem.d b/compiler/src/dmd/initsem.d index 4ef6b4a51e0e..579049d374ac 100644 --- a/compiler/src/dmd/initsem.d +++ b/compiler/src/dmd/initsem.d @@ -322,6 +322,11 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn else { ulong edim = tsa.dim.toInteger(); + if (i.defaultInitialize && hasIndices) + { + error(i.loc, "cannot use both indices and `...` in static array initializer"); + return err(); + } if (i.dim < edim && !i.defaultInitialize && !i.isCarray && !hasIndices && sc.hasEdition(Edition.v2024)) { diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d index fe19ba945b86..d30aa6091efb 100644 --- a/compiler/test/fail_compilation/array1.d +++ b/compiler/test/fail_compilation/array1.d @@ -2,9 +2,10 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/array1.d(19): Deprecation: array initializer has 3 elements, but array length is 4 -fail_compilation/array1.d(19): use `, ...]` if intentional -fail_compilation/array1.d(22): Error: can only use `...` in static array initializer +fail_compilation/array1.d(20): Deprecation: array initializer has 3 elements, but array length is 4 +fail_compilation/array1.d(20): use `, ...]` if intentional +fail_compilation/array1.d(23): Error: can only use `...` in static array initializer +fail_compilation/array1.d(24): Error: cannot use both indices and `...` in static array initializer --- */ @@ -19,4 +20,5 @@ static assert(b[3] == 0); immutable int[4] c = [1,2,3]; immutable int[4] d = [1:1]; // OK -int[] e = [1,...]; +immutable int[] e = [1,...]; +immutable int[4] f = [2:1,...]; From 1baa13364b1483b536f1d4d3ff07837873898b82 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sun, 3 May 2026 10:57:02 +0100 Subject: [PATCH 08/12] Update spec --- spec/arrays.dd | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/spec/arrays.dd b/spec/arrays.dd index 8dc3a27e1a41..34b168e6acf2 100644 --- a/spec/arrays.dd +++ b/spec/arrays.dd @@ -1140,11 +1140,11 @@ $(H3 $(LNAME2 array-initializers, Array Initializers)) $(GRAMMAR $(GNAME ArrayInitializer): - $(D [) $(I ArrayElementInitializers)$(OPT) $(D ]) + `[` *ArrayElementInitializers* `,`$(OPT) `]` + `[` *ArrayElementInitializers* `, ... ]` $(GNAME ArrayElementInitializers): $(I ArrayElementInitializer) - $(I ArrayElementInitializer) $(D ,) $(I ArrayElementInitializer) $(D ,) $(GSELF ArrayElementInitializers) $(GNAME ArrayElementInitializer): @@ -1153,7 +1153,12 @@ $(GNAME ArrayElementInitializer): ) $(P An *ArrayInitializer* is a list of element initializers enclosed in `[ ]`. - Each element initializer can be optionally preceded by an index expression and a `:`. + The $(GRAMMAR_INLINE *ArrayElementInitializers* `, ...`) form + $(RELATIVE_LINK2 static-init-static, can only be used) when the declaration + is a static array.) + + $(P Each element initializer can be optionally preceded by an index + expression and a `:`. If an index is not supplied, it is set to the previous index plus 1, or 0 if it is the first value. Any missing elements will be initialized to the default value @@ -1207,6 +1212,26 @@ assert(value == [5, 6, 2]); $(H3 $(LNAME2 static-init-static, Static Initialization of Statically Allocated Arrays)) + $(P When a static array type is expected, an *ArrayInitializer* must either:) + + - Match the expected number of elements in the type + - Have at least one element index provided + - Use the trailing `...` syntax + + $(P The `...` syntax is used to specify 0 or more missing elements. Any + missing elements will be initialized to the default value of the element type:) + +$(SPEC_RUNNABLE_EXAMPLE_RUN +--------- +int[4] a = [1, 2, 3, 4]; // OK + +//int[4] b = [1, 2]; // Error, missing elements +int[4] b = [1, 2, ...]; // OK + +void main() => assert(b == [1, 2, 0, 0]); +--------- +) + $(P All elements of a static array can be initialized to a specific value which implicitly converts to the array element type:) From f051086a48f23b08f271260909b0027877ac49ba Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sun, 3 May 2026 11:42:04 +0100 Subject: [PATCH 09/12] Remove unneeded immutable --- compiler/test/fail_compilation/array1.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d index d30aa6091efb..0b4715d8ee9e 100644 --- a/compiler/test/fail_compilation/array1.d +++ b/compiler/test/fail_compilation/array1.d @@ -17,8 +17,8 @@ static assert(a[3] == 0); immutable int[4] b = [1,2,3,...]; static assert(b[3] == 0); -immutable int[4] c = [1,2,3]; -immutable int[4] d = [1:1]; // OK +int[4] c = [1,2,3]; +int[4] d = [1:1]; // OK -immutable int[] e = [1,...]; -immutable int[4] f = [2:1,...]; +int[] e = [1,...]; +int[4] f = [2:1,...]; From 42d33e5257a0a41d2a3818ad072c325e8f9318d8 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 6 May 2026 10:29:24 +0100 Subject: [PATCH 10/12] Test nested initializer --- compiler/test/fail_compilation/array1.d | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/test/fail_compilation/array1.d b/compiler/test/fail_compilation/array1.d index 0b4715d8ee9e..92d5a1b0fad8 100644 --- a/compiler/test/fail_compilation/array1.d +++ b/compiler/test/fail_compilation/array1.d @@ -2,10 +2,12 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/array1.d(20): Deprecation: array initializer has 3 elements, but array length is 4 -fail_compilation/array1.d(20): use `, ...]` if intentional -fail_compilation/array1.d(23): Error: can only use `...` in static array initializer -fail_compilation/array1.d(24): Error: cannot use both indices and `...` in static array initializer +fail_compilation/array1.d(22): Deprecation: array initializer has 3 elements, but array length is 4 +fail_compilation/array1.d(22): use `, ...]` if intentional +fail_compilation/array1.d(25): Error: can only use `...` in static array initializer +fail_compilation/array1.d(26): Error: cannot use both indices and `...` in static array initializer +fail_compilation/array1.d(29): Deprecation: array initializer has 1 elements, but array length is 4 +fail_compilation/array1.d(29): use `, ...]` if intentional --- */ @@ -22,3 +24,7 @@ int[4] d = [1:1]; // OK int[] e = [1,...]; int[4] f = [2:1,...]; + +// nested initializer +int[4][] s1 = [[1]]; +int[4][] s2 = [[1,...]]; // OK From e71e112754513a4df062b9b04dd53f9f4170ef80 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 6 May 2026 11:32:34 +0100 Subject: [PATCH 11/12] Update hdrgen.d --- compiler/src/dmd/hdrgen.d | 2 ++ compiler/test/compilable/extra-files/vcg-ast.d.cg | 3 ++- compiler/test/compilable/vcg-ast.d | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/src/dmd/hdrgen.d b/compiler/src/dmd/hdrgen.d index 6ba5ee210387..d9e1c4b6fa7a 100644 --- a/compiler/src/dmd/hdrgen.d +++ b/compiler/src/dmd/hdrgen.d @@ -4265,6 +4265,8 @@ private void initializerToBuffer(Initializer inx, ref OutBuffer buf, ref HdrGenS if (auto iz = ai.value[i]) initializerToBuffer(iz, buf, hgs); } + if (ai.defaultInitialize) + buf.put(", ..."); buf.put(']'); } diff --git a/compiler/test/compilable/extra-files/vcg-ast.d.cg b/compiler/test/compilable/extra-files/vcg-ast.d.cg index dafad19e7b43..f1c97ae61511 100644 --- a/compiler/test/compilable/extra-files/vcg-ast.d.cg +++ b/compiler/test/compilable/extra-files/vcg-ast.d.cg @@ -108,6 +108,7 @@ template imported() alias myImport = vcg_ast_import; enum bool compiles = true; enum bool isexp = true; +int[3] arr = [1, ...]; R!int { struct _R @@ -257,4 +258,4 @@ RTInfo!(_R) { enum immutable(void)* RTInfo = null; -} +} \ No newline at end of file diff --git a/compiler/test/compilable/vcg-ast.d b/compiler/test/compilable/vcg-ast.d index 6a9055574008..1851b4b97fc4 100644 --- a/compiler/test/compilable/vcg-ast.d +++ b/compiler/test/compilable/vcg-ast.d @@ -88,3 +88,5 @@ enum isexp = is(typeof({ int[] arr; arr ~= 1; })); + +int[3] arr = [1, ...]; From 16b385bb95fa62f3592c966039ef735385969e89 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 6 May 2026 12:36:34 +0100 Subject: [PATCH 12/12] Update frontend.h --- compiler/src/dmd/frontend.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/src/dmd/frontend.h b/compiler/src/dmd/frontend.h index 8ce816a68199..13342237123e 100644 --- a/compiler/src/dmd/frontend.h +++ b/compiler/src/dmd/frontend.h @@ -4129,9 +4129,10 @@ class ArrayInitializer final : public Initializer public: Array index; Array value; - uint32_t dim; Type* type; + uint32_t dim; bool isCarray; + bool defaultInitialize; bool isAssociativeArray() const; void accept(Visitor* v) override; };