aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-04-02 00:36:57 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-04-02 19:31:32 -0400
commit83bb98e13b19d417c9a8de819b98a1566718b993 (patch)
tree04f9e65daaadd009ea06af7c603ff922f0262ba3 /test/behavior/error.zig
parenta0a587ff85d3785f99c475d9e0d5f1eb9e27bd26 (diff)
downloadzig-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.zig18
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;
+}