aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/struct.zig')
-rw-r--r--test/behavior/struct.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index 7b2587b3d6..08954dfd68 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -1842,3 +1842,18 @@ test "circular dependency through pointer field of a struct" {
try expect(outer.middle.outer == null);
try expect(outer.middle.inner == null);
}
+
+test "field calls do not force struct field init resolution" {
+ const S = struct {
+ x: u32 = blk: {
+ _ = @TypeOf(make().dummyFn()); // runtime field call - S not fully resolved - dummyFn call should not force field init resolution
+ break :blk 123;
+ },
+ dummyFn: *const fn () void = undefined,
+ fn make() @This() {
+ return .{};
+ }
+ };
+ var s: S = .{};
+ try expect(s.x == 123);
+}