aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-06-06 16:12:31 -0400
committerGitHub <noreply@github.com>2022-06-06 16:12:31 -0400
commit367e2b2fe43a2de09767ad8d5657866088b44678 (patch)
tree686b57ecfcfd472d70493c46c60a562b96d5ad31 /test/behavior/struct.zig
parent41bf81dc3231eb763c93eb95b152e7ab8d3c5af8 (diff)
parent14685e59b26c8dc002ce6c25c6916cbad54e79d0 (diff)
downloadzig-367e2b2fe43a2de09767ad8d5657866088b44678.tar.gz
zig-367e2b2fe43a2de09767ad8d5657866088b44678.zip
Merge pull request #11800 from Vexu/stage2
`zig2 build test-std` progress
Diffstat (limited to 'test/behavior/struct.zig')
-rw-r--r--test/behavior/struct.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index 5cbb8e973e..624f1609d4 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -1336,3 +1336,25 @@ test "packed struct field access via pointer" {
try S.doTheTest();
comptime try S.doTheTest();
}
+
+test "store to comptime field" {
+ if (builtin.zig_backend == .stage1) return error.SkipZigTest;
+
+ {
+ const S = struct {
+ comptime a: [2]u32 = [2]u32{ 1, 2 },
+ };
+ var s: S = .{};
+ s.a = [2]u32{ 1, 2 };
+ s.a[0] = 1;
+ }
+ {
+ const T = struct { a: u32, b: u32 };
+ const S = struct {
+ comptime a: T = T{ .a = 1, .b = 2 },
+ };
+ var s: S = .{};
+ s.a = T{ .a = 1, .b = 2 };
+ s.a.a = 1;
+ }
+}