mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 17:12:31 +00:00
parent
5f5ab49168
commit
5259d11e3b
@ -3948,6 +3948,7 @@ fn validateArrayInitTy(
|
||||
return;
|
||||
},
|
||||
.Struct => if (ty.isTuple()) {
|
||||
_ = try sema.resolveTypeFields(ty);
|
||||
const array_len = ty.arrayLen();
|
||||
if (extra.init_count > array_len) {
|
||||
return sema.fail(block, src, "expected at most {d} tuple fields; found {d}", .{
|
||||
|
@ -1573,3 +1573,8 @@ test "struct fields get automatically reordered" {
|
||||
};
|
||||
try expect(@sizeOf(S1) == @sizeOf(S2));
|
||||
}
|
||||
|
||||
test "directly initiating tuple like struct" {
|
||||
const a = struct { u8 }{8};
|
||||
try expect(a[0] == 8);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user