diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-30 01:12:47 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-30 01:12:47 -0400 |
| commit | 56cc62a9c7bf9bfb1daff7dc60a75c380500ebce (patch) | |
| tree | f65b8b9e7e7815d04630d5aab78b7b89b12b3152 /test | |
| parent | fa9006f8d1aa95934f31d5bedfcd3949267c9e72 (diff) | |
| download | zig-56cc62a9c7bf9bfb1daff7dc60a75c380500ebce.tar.gz zig-56cc62a9c7bf9bfb1daff7dc60a75c380500ebce.zip | |
@ptrCast preserves larger alignment if applicable
See #37
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/align.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/cases/align.zig b/test/cases/align.zig index cef45904a3..460b3af015 100644 --- a/test/cases/align.zig +++ b/test/cases/align.zig @@ -136,3 +136,10 @@ test "generic function with align param" { } fn whyWouldYouEverDoThis(comptime align_bytes: u8) align align_bytes -> u8 { 0x1 } + + +test "@ptrCast preserves alignment of bigger source" { + var x: u32 align 16 = 1234; + const ptr = @ptrCast(&u8, &x); + assert(@typeOf(ptr) == &align 16 u8); +} |
