diff --git a/test/stage1/behavior/type_info.zig b/test/stage1/behavior/type_info.zig index 9d577ec0b4a95d0b1062065964910606df174ade..a3988cba6d4de766642fca7d477e6a8325e1af66 100644 --- a/test/stage1/behavior/type_info.zig +++ b/test/stage1/behavior/type_info.zig @@ -375,3 +375,14 @@ test "sentinel of opaque pointer type" { const c_void_info = @typeInfo(*c_void); expect(c_void_info.Pointer.sentinel == null); } + +test "@typeInfo does not force declarations into existence" { + const S = struct { + x: i32, + + fn doNotReferenceMe() void { + @compileError("test failed"); + } + }; + comptime expect(@typeInfo(S).Struct.fields.len == 1); +}