Commit f7574f44c1

Andrew Kelley <andrew@ziglang.org>
2019-11-24 21:20:15
add test for struct with var field
1 parent 44b1dc6
Changed files (1)
test
stage1
behavior
test/stage1/behavior/struct.zig
@@ -777,3 +777,16 @@ test "anonymous struct literal assigned to variable" {
     vec.@"1" += 1;
     expect(vec.@"1" == 56);
 }
+
+test "struct with var field" {
+    const Point = struct {
+        x: var,
+        y: var,
+    };
+    const pt = Point {
+        .x = 1,
+        .y = 2,
+    };
+    expect(pt.x == 1);
+    expect(pt.y == 2);
+}