diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-02-26 10:05:04 +0100 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2020-02-26 10:05:04 +0100 |
| commit | d2535c003c6188fcc362028e01ef9f7fb3356727 (patch) | |
| tree | d6cb0c35e9d541af21ce2ed015e6f2b33a29c9c7 /test | |
| parent | b46efcde82436e73c73dab132f73aeff98673894 (diff) | |
| download | zig-d2535c003c6188fcc362028e01ef9f7fb3356727.tar.gz zig-d2535c003c6188fcc362028e01ef9f7fb3356727.zip | |
ir: Fix regression with self-referencing containers
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/sizeof_and_typeof.zig | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/stage1/behavior/sizeof_and_typeof.zig b/test/stage1/behavior/sizeof_and_typeof.zig index e3b62b15cc..322c5fbbad 100644 --- a/test/stage1/behavior/sizeof_and_typeof.zig +++ b/test/stage1/behavior/sizeof_and_typeof.zig @@ -145,6 +145,26 @@ test "@sizeOf comparison against zero" { const U0 = union { f: *@This(), }; + const S1 = struct { + fn H(comptime T: type) type { + return struct { + x: T, + }; + } + f0: H(*@This()), + f1: H(**@This()), + f2: H(***@This()), + }; + const U1 = union { + fn H(comptime T: type) type { + return struct { + x: T, + }; + } + f0: H(*@This()), + f1: H(**@This()), + f2: H(***@This()), + }; const S = struct { fn doTheTest(comptime T: type, comptime result: bool) void { expectEqual(result, @sizeOf(T) > 0); @@ -164,4 +184,6 @@ test "@sizeOf comparison against zero" { // Container with ptr pointing to themselves S.doTheTest(S0, true); S.doTheTest(U0, true); + S.doTheTest(S1, true); + S.doTheTest(U1, true); } |
