aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-06-24 13:37:39 -0400
committerkcbanner <kcbanner@gmail.com>2023-06-24 13:49:24 -0400
commitbaa2b62e88c5438c95ab439b12d3bafa55fd21a0 (patch)
tree1e16229de7fe903666cf0f76c294d36c39594cc9 /test/behavior/error.zig
parenta5e15eced0e9cb00871966ede74eed9b3a07183c (diff)
downloadzig-baa2b62e88c5438c95ab439b12d3bafa55fd21a0.tar.gz
zig-baa2b62e88c5438c95ab439b12d3bafa55fd21a0.zip
cbe: fix crash caused by calling `mod.intValue` on `type_inferred_error_set`
Diffstat (limited to 'test/behavior/error.zig')
-rw-r--r--test/behavior/error.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig
index 14b0eca030..be0de6932d 100644
--- a/test/behavior/error.zig
+++ b/test/behavior/error.zig
@@ -921,3 +921,20 @@ test "optional error set return type" {
try expect(null == S.foo(true));
try expect(E.A == S.foo(false).?);
}
+
+test "returning an error union containing a type with no runtime bits" {
+ 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_spirv64) return error.SkipZigTest;
+
+ const ZeroByteType = struct {
+ foo: void,
+
+ pub fn init() !@This() {
+ return .{ .foo = {} };
+ }
+ };
+
+ var zero_byte: ZeroByteType = undefined;
+ (&zero_byte).* = try ZeroByteType.init();
+}