aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-01-18 19:58:05 +0100
committerLemonBoy <thatlemon@gmail.com>2020-01-18 20:16:15 +0100
commitb0f753e21d6fcaafd0b35dc02fdfe23b14e310d6 (patch)
tree0a4a4983b88edf9bf4bf36ae6fde7ead4e3870f6 /test
parentc53d94e5127a8dcfefd906c5be0e6b81eaf3d22c (diff)
downloadzig-b0f753e21d6fcaafd0b35dc02fdfe23b14e310d6.tar.gz
zig-b0f753e21d6fcaafd0b35dc02fdfe23b14e310d6.zip
Fix edge case in tagName handling of unions
Closes #4226
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/union.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/stage1/behavior/union.zig b/test/stage1/behavior/union.zig
index a24bee03e6..4625b7573a 100644
--- a/test/stage1/behavior/union.zig
+++ b/test/stage1/behavior/union.zig
@@ -629,3 +629,12 @@ test "union initializer generates padding only if needed" {
var v = U{ .A = 532 };
expect(v.A == 532);
}
+
+test "runtime tag name with single field" {
+ const U = union(enum) {
+ A: i32,
+ };
+
+ var v = U{ .A = 42 };
+ expect(std.mem.eql(u8, @tagName(v), "A"));
+}