Commit 89cac88e91

Jacob Young <jacobly0@users.noreply.github.com>
2023-11-10 23:56:30
behavior: add testing for LLVM SROA bugs
1 parent 59375b3
Changed files (1)
test
behavior
test/behavior/union.zig
@@ -2042,3 +2042,20 @@ test "circular dependency through pointer field of a union" {
     try expect(outer.u.outer == null);
     try expect(outer.u.inner == null);
 }
+
+test "pass nested union with rls" {
+    const Union = union(enum) {
+        a: u32,
+        b: union(enum) {
+            c: u7,
+            d: u3,
+        },
+
+        fn getC(u: @This()) u7 {
+            return u.b.c;
+        }
+    };
+
+    var c: u7 = 32;
+    try expectEqual(@as(u7, 32), Union.getC(.{ .b = .{ .c = c } }));
+}