Skip to content

Commit 1880b9a

Browse files
committed
behavior and cases: more test coverage for old issues
Closes ziglang#2622 Closes ziglang#2727 Closes ziglang#6047 Closes ziglang#6947 Closes ziglang#6656
1 parent 0228bbe commit 1880b9a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

compile_errors/invalid_store_to_comptime_field.zig

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub export fn entry4() void {
4141
_ = U.foo(.{ .foo = 2, .bar = 2 });
4242
}
4343
pub export fn entry5() void {
44-
comptime var y = .{ 1, 2};
44+
comptime var y = .{ 1, 2 };
4545
y = .{ 3, 4 };
4646
}
4747
// pub export fn entry5() void {
@@ -52,7 +52,15 @@ pub export fn entry5() void {
5252
// };
5353
// _ = S.foo(.{ -1234, 5679, x });
5454
// }
55-
55+
pub export fn entry6() void {
56+
const State = struct {
57+
comptime id: bool = true,
58+
fn init(comptime id: bool) @This() {
59+
return @This(){ .id = id };
60+
}
61+
};
62+
_ = State.init(false);
63+
}
5664

5765
// error
5866
// target=native
@@ -65,3 +73,4 @@ pub export fn entry5() void {
6573
// :25:29: note: default value set here
6674
// :41:16: error: value stored in comptime field does not match the default value of the field
6775
// :45:12: error: value stored in comptime field does not match the default value of the field
76+
// :59:35: error: value stored in comptime field does not match the default value of the field

0 commit comments

Comments
 (0)