diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-03-24 00:55:55 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-03-24 00:55:55 -0400 |
| commit | a736dfe6a1c7a43c9cb9474255ec34261e5f80ab (patch) | |
| tree | a85e8b82f6bfdcb51be6ea4c314a5336f25cc675 /test | |
| parent | d0551db5cd29e4c7f361ef40a37486138a4e8b1e (diff) | |
| download | zig-a736dfe6a1c7a43c9cb9474255ec34261e5f80ab.tar.gz zig-a736dfe6a1c7a43c9cb9474255ec34261e5f80ab.zip | |
implement implicit cast from enum literal to enum
See #683
Diffstat (limited to 'test')
| -rw-r--r-- | test/stage1/behavior/enum.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/stage1/behavior/enum.zig b/test/stage1/behavior/enum.zig index fb6fa63593..2be675ea34 100644 --- a/test/stage1/behavior/enum.zig +++ b/test/stage1/behavior/enum.zig @@ -901,3 +901,15 @@ test "enum literal equality" { expect(x != y); expect(x == z); } + +test "enum literal cast to enum" { + const Color = enum { + Auto, + Off, + On, + }; + + var color1: Color = .Auto; + var color2 = Color.Auto; + expect(color1 == color2); +} |
