diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-09-19 12:38:31 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-09-19 18:34:52 +0300 |
| commit | e584558bd8533ce91d1683cdbc6b77d7bb652acf (patch) | |
| tree | 640be3ada9fe338c396adbae29e6dccc54987d71 /test/behavior/align.zig | |
| parent | e42f83825f1473661700f89ffd3060013261d605 (diff) | |
| download | zig-e584558bd8533ce91d1683cdbc6b77d7bb652acf.tar.gz zig-e584558bd8533ce91d1683cdbc6b77d7bb652acf.zip | |
Sema: do not use coerceCompatiblePtr for alignCast
Closes #12902
Diffstat (limited to 'test/behavior/align.zig')
| -rw-r--r-- | test/behavior/align.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/behavior/align.zig b/test/behavior/align.zig index ad857fb9c2..51481580cf 100644 --- a/test/behavior/align.zig +++ b/test/behavior/align.zig @@ -556,3 +556,11 @@ test "comptime alloc alignment" { var bytes2_addr = @ptrToInt(&bytes2); try expect(bytes2_addr & 0xff == 0); } + +test "@alignCast null" { + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; + + var ptr: ?*anyopaque = null; + const aligned: ?*anyopaque = @alignCast(@alignOf(?*anyopaque), ptr); + try expect(aligned == null); +} |
