diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2022-12-24 19:44:52 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-12-25 20:18:15 -0500 |
| commit | f5b6019646fe76678c993596130f03116989eb12 (patch) | |
| tree | 9b5a112189d53c3f591c0ae33e5dc208e318daf2 /test/behavior/struct.zig | |
| parent | 0c30e006c90db4e6ca77d9054d391340282b96f6 (diff) | |
| download | zig-f5b6019646fe76678c993596130f03116989eb12.tar.gz zig-f5b6019646fe76678c993596130f03116989eb12.zip | |
Sema: fix missing struct layout for llvm backend
Closes #14063
Diffstat (limited to 'test/behavior/struct.zig')
| -rw-r--r-- | test/behavior/struct.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index b6567b14c3..a23294a102 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -1419,3 +1419,16 @@ test "struct field has a pointer to an aligned version of itself" { try expect(&e == e.next); } + +test "struct only referenced from optional parameter/return" { + const S = struct { + fn f(_: ?struct { x: u8 }) void {} + fn g() ?struct { x: u8 } { + return null; + } + }; + + const fp: *const anyopaque = &S.f; + const gp: *const anyopaque = &S.g; + try expect(fp != gp); +} |
