diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-09-02 16:08:20 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-09-02 17:57:11 +0300 |
| commit | f281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f (patch) | |
| tree | 3a28628a95126b07fe7fa17e12ff3cbab1e9df65 /test/cases/compile_errors | |
| parent | a9cdacff95a2a6f60945c7b2a299f9f66bd94ddb (diff) | |
| download | zig-f281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f.tar.gz zig-f281f3d10e4eaedc7c68afc4fcbbfd35e1f29a0f.zip | |
Sema: improve behavior of comptime_int backed enums
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/enum_backed_by_comptime_int_must_be_comptime.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cases/compile_errors/enum_backed_by_comptime_int_must_be_comptime.zig b/test/cases/compile_errors/enum_backed_by_comptime_int_must_be_comptime.zig new file mode 100644 index 0000000000..7dab294d4a --- /dev/null +++ b/test/cases/compile_errors/enum_backed_by_comptime_int_must_be_comptime.zig @@ -0,0 +1,11 @@ +pub export fn entry() void { + const E = enum(comptime_int) { a, b, c, _ }; + var e: E = .a; + _ = e; +} + +// error +// backend=stage2 +// target=native +// +// :3:12: error: variable of type 'tmp.entry.E' must be const or comptime |
