aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2019-09-09 19:09:56 +0200
committerLemonBoy <thatlemon@gmail.com>2019-09-09 19:09:56 +0200
commit4b1cd45472cab5569438fef018990fbe8043c6c3 (patch)
treeae1f233ad992910d92b3882202cda30808491d4e /test
parentcc6376058784aa7a910e93c31ac8bd819de4e187 (diff)
downloadzig-4b1cd45472cab5569438fef018990fbe8043c6c3.tar.gz
zig-4b1cd45472cab5569438fef018990fbe8043c6c3.zip
Comptime folding of enum/union comparisons
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/union.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/stage1/behavior/union.zig b/test/stage1/behavior/union.zig
index 1f8ca82958..7c5c653275 100644
--- a/test/stage1/behavior/union.zig
+++ b/test/stage1/behavior/union.zig
@@ -468,7 +468,7 @@ test "union no tag with struct member" {
u.foo();
}
-test "comparison between union and enum literal" {
+fn testComparison() void {
var x = Payload{.A = 42};
expect(x == .A);
expect(x != .B);
@@ -477,3 +477,8 @@ test "comparison between union and enum literal" {
expect((x == .C) == false);
expect((x != .A) == false);
}
+
+test "comparison between union and enum literal" {
+ testComparison();
+ comptime testComparison();
+}