diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-04-02 00:36:57 +0300 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-04-02 19:31:32 -0400 |
| commit | 83bb98e13b19d417c9a8de819b98a1566718b993 (patch) | |
| tree | 04f9e65daaadd009ea06af7c603ff922f0262ba3 /test/behavior/error.zig | |
| parent | a0a587ff85d3785f99c475d9e0d5f1eb9e27bd26 (diff) | |
| download | zig-83bb98e13b19d417c9a8de819b98a1566718b993.tar.gz zig-83bb98e13b19d417c9a8de819b98a1566718b993.zip | |
stage2 llvm: properly align error union payload
Diffstat (limited to 'test/behavior/error.zig')
| -rw-r--r-- | test/behavior/error.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig index 3030ea67ed..3c19471705 100644 --- a/test/behavior/error.zig +++ b/test/behavior/error.zig @@ -644,3 +644,21 @@ test "coerce error set to the current inferred error set" { }; S.foo() catch {}; } + +test "error union payload is properly aligned" { + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + + const S = struct { + a: u128, + b: u128, + c: u128, + fn foo() error{}!@This() { + return @This(){ .a = 1, .b = 2, .c = 3 }; + } + }; + const blk = S.foo() catch unreachable; + if (blk.a != 1) unreachable; +} |
