diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-12-11 16:28:48 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-12-14 14:05:57 +0200 |
| commit | 327fb798c3a2fb18588fc79b1f024cfdd166a4e9 (patch) | |
| tree | 147b55e8e691d28f466f6f3cfe0fd24ac9f5ee98 /test/cases/compile_errors/union_runtime_coercion_from_enum.zig | |
| parent | 0b4461d97b5d315e71302f96076c54bbdffb7717 (diff) | |
| download | zig-327fb798c3a2fb18588fc79b1f024cfdd166a4e9.tar.gz zig-327fb798c3a2fb18588fc79b1f024cfdd166a4e9.zip | |
move stage2 compile errors out of special folder
Diffstat (limited to 'test/cases/compile_errors/union_runtime_coercion_from_enum.zig')
| -rw-r--r-- | test/cases/compile_errors/union_runtime_coercion_from_enum.zig | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/cases/compile_errors/union_runtime_coercion_from_enum.zig b/test/cases/compile_errors/union_runtime_coercion_from_enum.zig new file mode 100644 index 0000000000..9020e9d5d7 --- /dev/null +++ b/test/cases/compile_errors/union_runtime_coercion_from_enum.zig @@ -0,0 +1,23 @@ +const E = enum { + a, + b, +}; +const U = union(E) { + a: u32, + b: u64, +}; +fn foo() E { + return E.b; +} +export fn doTheTest() u64 { + var u: U = foo(); + return u.b; +} + +// error +// target=native +// +// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields +// :6:5: note: field 'a' has type 'u32' +// :7:5: note: field 'b' has type 'u64' +// :5:11: note: union declared here |
