aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-08-30 01:12:47 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-08-30 01:12:47 -0400
commit56cc62a9c7bf9bfb1daff7dc60a75c380500ebce (patch)
treef65b8b9e7e7815d04630d5aab78b7b89b12b3152 /test
parentfa9006f8d1aa95934f31d5bedfcd3949267c9e72 (diff)
downloadzig-56cc62a9c7bf9bfb1daff7dc60a75c380500ebce.tar.gz
zig-56cc62a9c7bf9bfb1daff7dc60a75c380500ebce.zip
@ptrCast preserves larger alignment if applicable
See #37
Diffstat (limited to 'test')
-rw-r--r--test/cases/align.zig7
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);
+}