aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-12-03 00:42:11 -0500
committerGitHub <noreply@github.com>2022-12-03 00:42:11 -0500
commitfdbb0fb7b9c08ebff1b7e45ef89f7160f350d44c (patch)
tree714f2766c64ace45df1f7d67ca70be0c88193184 /test/behavior
parentc43ac67f82cb5a022df67729aa1e6bebc22cfff2 (diff)
parentb500e0eb179218f5eb03408c09b5e5a928f0c46e (diff)
downloadzig-fdbb0fb7b9c08ebff1b7e45ef89f7160f350d44c.tar.gz
zig-fdbb0fb7b9c08ebff1b7e45ef89f7160f350d44c.zip
Merge pull request #13744 from Vexu/stage2-fixes
Improve error messages, fix dependency loops
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/bugs/12498.zig8
-rw-r--r--test/behavior/struct.zig12
2 files changed, 20 insertions, 0 deletions
diff --git a/test/behavior/bugs/12498.zig b/test/behavior/bugs/12498.zig
new file mode 100644
index 0000000000..3e4bafc2db
--- /dev/null
+++ b/test/behavior/bugs/12498.zig
@@ -0,0 +1,8 @@
+const std = @import("std");
+const expect = std.testing.expect;
+
+const S = struct { a: usize };
+test "lazy abi size used in comparison" {
+ var rhs: i32 = 100;
+ try expect(@sizeOf(S) < rhs);
+}
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index a74b9fdd53..1807b7a447 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -1406,3 +1406,15 @@ test "address of zero-bit field is equal to address of only field" {
try std.testing.expectEqual(&a, a_ptr);
}
}
+
+test "struct field has a pointer to an aligned version of itself" {
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
+
+ const E = struct {
+ next: *align(1) @This(),
+ };
+ var e: E = undefined;
+ e = .{ .next = &e };
+
+ try expect(&e == e.next);
+}