aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.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 /lib/std/meta.zig
parentfb91483e48fe6cfa21edc613f266e27bd6bf9dbf (diff)
downloadzig-541b3e3a31946475f29d21e7a742bf80c5952791.tar.gz
zig-541b3e3a31946475f29d21e7a742bf80c5952791.zip
Sema: check pointer qualifiers before implicit cast
Closes #12881
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 7e64eff49f..993d88eb04 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -204,12 +204,12 @@ pub fn sentinel(comptime T: type) ?Elem(T) {
switch (info.size) {
.Many, .Slice => {
const sentinel_ptr = info.sentinel orelse return null;
- return @ptrCast(*const info.child, sentinel_ptr).*;
+ return @ptrCast(*align(1) const info.child, sentinel_ptr).*;
},
.One => switch (@typeInfo(info.child)) {
.Array => |array_info| {
const sentinel_ptr = array_info.sentinel orelse return null;
- return @ptrCast(*const array_info.child, sentinel_ptr).*;
+ return @ptrCast(*align(1) const array_info.child, sentinel_ptr).*;
},
else => {},
},