diff options
Diffstat (limited to 'test/behavior/pointers.zig')
| -rw-r--r-- | test/behavior/pointers.zig | 11 |
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); +} |
