authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-04-28 13:01:06+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-04-29 23:27:58+01:00
log7b44e8986fa0a8121993ab328b129789127a13bd
tree283543b2691a1cc62d0c79a762cd3a68fd892faf
parent106850fd4cc218f77d5b37738095c7afd7d7b74b
signaturelock-open Commit is signed but in an unrecognized format.

Sema: remove `void{}` from the language

Because this syntax is not heavily used, and the migration can be done with a simple text substitution, I do not believe a `zig fmt` fixup is necessary for this change. Resolves: https://github.com/ziglang/zig/issues/15213

2 files changed, 7 insertions(+), 1 deletions(-)

src/Sema.zig-1
......@@ -18339,7 +18339,6 @@ fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
1833918339 switch (obj_ty.zigTypeTag(zcu)) {
1834018340 .@"struct" => return sema.structInitEmpty(block, obj_ty, src, src),
1834118341 .array, .vector => return sema.arrayInitEmpty(block, src, obj_ty),
18342 .void => return Air.internedToRef(Value.void.toIntern()),
1834318342 .@"union" => return sema.fail(block, src, "union initializer must initialize one field", .{}),
1834418343 else => return sema.failWithArrayInitNotSupported(block, src, obj_ty),
1834518344 }
test/cases/compile_errors/bad_void_initializer.zig created+7
......@@ -0,0 +1,7 @@
1comptime {
2 _ = void{};
3}
4
5// error
6//
7// :2:13: error: type 'void' does not support array initialization syntax