diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-09-19 14:36:41 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-09-20 00:50:13 +0300 |
| commit | 541b3e3a31946475f29d21e7a742bf80c5952791 (patch) | |
| tree | 4516d103301ab7913786679f3f2e988bf7029eb5 /lib/std/json.zig | |
| parent | fb91483e48fe6cfa21edc613f266e27bd6bf9dbf (diff) | |
| download | zig-541b3e3a31946475f29d21e7a742bf80c5952791.tar.gz zig-541b3e3a31946475f29d21e7a742bf80c5952791.zip | |
Sema: check pointer qualifiers before implicit cast
Closes #12881
Diffstat (limited to 'lib/std/json.zig')
| -rw-r--r-- | lib/std/json.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/json.zig b/lib/std/json.zig index 548a3db94e..87fe1c9dea 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -1560,7 +1560,7 @@ fn parseInternal( } } if (field.is_comptime) { - if (!try parsesTo(field.field_type, @ptrCast(*const field.field_type, field.default_value.?).*, tokens, child_options)) { + if (!try parsesTo(field.field_type, @ptrCast(*align(1) const field.field_type, field.default_value.?).*, tokens, child_options)) { return error.UnexpectedValue; } } else { @@ -1587,7 +1587,7 @@ fn parseInternal( if (!fields_seen[i]) { if (field.default_value) |default_ptr| { if (!field.is_comptime) { - const default = @ptrCast(*const field.field_type, default_ptr).*; + const default = @ptrCast(*align(1) const field.field_type, default_ptr).*; @field(r, field.name) = default; } } else { @@ -1667,7 +1667,7 @@ fn parseInternal( } if (ptrInfo.sentinel) |some| { - const sentinel_value = @ptrCast(*const ptrInfo.child, some).*; + const sentinel_value = @ptrCast(*align(1) const ptrInfo.child, some).*; try arraylist.append(sentinel_value); const output = arraylist.toOwnedSlice(); return output[0 .. output.len - 1 :sentinel_value]; |
