Meg's Mirrors
zig
about
heads
tags
log
tree
search
Search
zig
doc
langref
struct_default_field_values.zig
pretty
plain
permalink
blame
history
•
15 lines
•
223 B
1
const Foo = struct {
2
a: i32 = 1234,
3
b: i32,
4
};
5
6
test "default struct initialization fields" {
7
const x: Foo = .{
8
.b = 5,
9
};
10
if (x.a + x.b != 1239) {
11
comptime unreachable;
12
}
13
}
14
15
// test