From f7574f44c120dc834ebaf2773dc1ab098a20c232 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 24 Nov 2019 15:20:15 -0500 Subject: [PATCH] add test for struct with var field --- test/stage1/behavior/struct.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/stage1/behavior/struct.zig b/test/stage1/behavior/struct.zig index e42bd4e9d7..7c2e58f2cb 100644 --- a/test/stage1/behavior/struct.zig +++ b/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); +}