aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/pointers.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-09-09 10:26:17 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-09-09 10:26:17 -0700
commit37cdb5dbf90acd61584bae4a6661d0a6f9b54295 (patch)
tree6b369bbd58603d40b17b0e16e157a757b4a01616 /test/behavior/pointers.zig
parentb7900de1684021ff86c67105e14e34968821ea02 (diff)
parent9e070b653c89a9216f9dd9f78ed7c78c11460ac7 (diff)
downloadzig-37cdb5dbf90acd61584bae4a6661d0a6f9b54295.tar.gz
zig-37cdb5dbf90acd61584bae4a6661d0a6f9b54295.zip
Merge remote-tracking branch 'origin/master' into llvm15
Diffstat (limited to 'test/behavior/pointers.zig')
-rw-r--r--test/behavior/pointers.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig
index adbc308742..dcdea1ff80 100644
--- a/test/behavior/pointers.zig
+++ b/test/behavior/pointers.zig
@@ -486,3 +486,14 @@ test "array slicing to slice" {
try S.doTheTest();
comptime try S.doTheTest();
}
+
+test "pointer to constant decl preserves alignment" {
+ const S = struct {
+ a: u8,
+ b: u8,
+ const aligned align(8) = @This(){ .a = 3, .b = 4 };
+ };
+
+ const alignment = @typeInfo(@TypeOf(&S.aligned)).Pointer.alignment;
+ try std.testing.expect(alignment == 8);
+}