aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/union.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/stage1/behavior/union.zig b/test/stage1/behavior/union.zig
index 7c5c653275..21308b0ea2 100644
--- a/test/stage1/behavior/union.zig
+++ b/test/stage1/behavior/union.zig
@@ -482,3 +482,15 @@ test "comparison between union and enum literal" {
testComparison();
comptime testComparison();
}
+
+test "packed union generates correctly aligned LLVM type" {
+ const U = packed union {
+ f1: fn () void,
+ f2: u32,
+ };
+ var foo = [_]U{
+ U{ .f1 = doTest },
+ U{ .f2 = 0 },
+ };
+ foo[0].f1();
+}