diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-03-07 14:35:48 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-03-07 14:35:48 -0500 |
| commit | 790aaeacaea88782987c4145bc7ae47a401563f1 (patch) | |
| tree | 0aad6bf2e1c29b0dab883a2633b4d380f68dfc51 /test/compile_errors.zig | |
| parent | bb80daf509b7afd84fe3076347e69e8f39f586d6 (diff) | |
| download | zig-790aaeacaea88782987c4145bc7ae47a401563f1.tar.gz zig-790aaeacaea88782987c4145bc7ae47a401563f1.zip | |
add compile error for using @tagName on extern union
closes #742
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 1bca093e79..564ad5d521 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,6 +1,19 @@ const tests = @import("tests.zig"); pub fn addCases(cases: &tests.CompileErrorContext) void { + cases.add("@tagName used on union with no associated enum tag", + \\const FloatInt = extern union { + \\ Float: f32, + \\ Int: i32, + \\}; + \\export fn entry() void { + \\ var fi = FloatInt{.Float = 123.45}; + \\ var tagName = @tagName(fi); + \\} + , + ".tmp_source.zig:7:19: error: union has no associated enum", + ".tmp_source.zig:1:18: note: declared here"); + cases.add("returning error from void async function", \\const std = @import("std"); \\export fn entry() void { |
