aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/slice.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-09-19 14:36:41 +0300
committerVeikka Tuominen <git@vexu.eu>2022-09-20 00:50:13 +0300
commit541b3e3a31946475f29d21e7a742bf80c5952791 (patch)
tree4516d103301ab7913786679f3f2e988bf7029eb5 /test/behavior/slice.zig
parentfb91483e48fe6cfa21edc613f266e27bd6bf9dbf (diff)
downloadzig-541b3e3a31946475f29d21e7a742bf80c5952791.tar.gz
zig-541b3e3a31946475f29d21e7a742bf80c5952791.zip
Sema: check pointer qualifiers before implicit cast
Closes #12881
Diffstat (limited to 'test/behavior/slice.zig')
-rw-r--r--test/behavior/slice.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig
index b9bae08878..e5cb8ea408 100644
--- a/test/behavior/slice.zig
+++ b/test/behavior/slice.zig
@@ -322,11 +322,12 @@ test "empty array to slice" {
test "@ptrCast slice to pointer" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+ if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
const S = struct {
fn doTheTest() !void {
var array align(@alignOf(u16)) = [5]u8{ 0xff, 0xff, 0xff, 0xff, 0xff };
- var slice: []u8 = &array;
+ var slice: []align(@alignOf(u16)) u8 = &array;
var ptr = @ptrCast(*u16, slice);
try expect(ptr.* == 65535);
}