diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-03-29 21:22:14 -0400 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-03-30 11:54:24 +0300 |
| commit | 0543def52f5ec2d76dc415da2546e478af491ac3 (patch) | |
| tree | cd08fe58ac0bf9f030a9f079ad5dff2ab1d0f002 /test/behavior | |
| parent | ff97bd21c3b6a5079f33ff389da0716a12806e29 (diff) | |
| download | zig-0543def52f5ec2d76dc415da2546e478af491ac3.tar.gz zig-0543def52f5ec2d76dc415da2546e478af491ac3.zip | |
llvm: fix crashes when loading a struct field
The result of buildStructGEP is not always a GEP (sorry), so we can't
use getGEPResultElementType on it.
Closes #14641
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/union.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/union.zig b/test/behavior/union.zig index 35bdca270e..20ad0a60ff 100644 --- a/test/behavior/union.zig +++ b/test/behavior/union.zig @@ -1529,3 +1529,14 @@ test "reinterpreting enum value inside packed union" { try U.doTest(); comptime try U.doTest(); } + +test "access the tag of a global tagged union" { + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + + const U = union(enum) { + a, + b: u8, + var u: @This() = .a; + }; + try expect(U.u == .a); +} |
