diff options
Diffstat (limited to 'test/behavior/switch.zig')
| -rw-r--r-- | test/behavior/switch.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behavior/switch.zig b/test/behavior/switch.zig index c44f8fe223..3a49c03b18 100644 --- a/test/behavior/switch.zig +++ b/test/behavior/switch.zig @@ -672,3 +672,21 @@ test "capture of integer forwards the switch condition directly" { comptime try S.foo(42); comptime try S.foo(100); } + +test "enum value without tag name used as switch item" { + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + + const E = enum(u32) { + a = 1, + b = 2, + _, + }; + var e: E = @intToEnum(E, 0); + switch (e) { + @intToEnum(E, 0) => {}, + .a => return error.TestFailed, + .b => return error.TestFailed, + _ => return error.TestFailed, + } +} |
