struct_default_field_values.zig (223B) - Raw
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