Commit 725dec6aa7
Changed files (3)
src
test
src/Sema.zig
@@ -30670,6 +30670,19 @@ fn checkPtrAttributes(sema: *Sema, dest_ty: Type, inst_ty: Type, in_memory_resul
} };
return false;
}
+
+ if (inst_info.packed_offset.host_size != dest_info.packed_offset.host_size or
+ inst_info.packed_offset.bit_offset != dest_info.packed_offset.bit_offset)
+ {
+ in_memory_result.* = .{ .ptr_bit_range = .{
+ .actual_host = inst_info.packed_offset.host_size,
+ .wanted_host = dest_info.packed_offset.host_size,
+ .actual_offset = inst_info.packed_offset.bit_offset,
+ .wanted_offset = dest_info.packed_offset.bit_offset,
+ } };
+ return false;
+ }
+
return true;
}
test/cases/compile_errors/implicitly_increasing_pointer_alignment.zig
@@ -14,6 +14,7 @@ fn bar(x: *u32) void {
// error
//
-// :8:9: error: expected type '*u32', found '*align(1) u32'
-// :8:9: note: pointer alignment '1' cannot cast into pointer alignment '4'
+// :8:9: error: expected type '*u32', found '*align(8:8:8) u32'
+// :8:9: note: pointer host size '8' cannot cast into pointer host size '0'
+// :8:9: note: pointer bit offset '8' cannot cast into pointer bit offset '0'
// :11:11: note: parameter type declared here
test/cases/compile_errors/implicitly_increasing_slice_alignment.zig
@@ -15,5 +15,6 @@ fn bar(x: []u32) void {
// error
//
-// :9:22: error: expected type '*[1]u32', found '*align(1) u32'
-// :9:22: note: pointer alignment '1' cannot cast into pointer alignment '4'
+// :9:22: error: expected type '*[1]u32', found '*align(8:8:8) u32'
+// :9:22: note: pointer host size '8' cannot cast into pointer host size '0'
+// :9:22: note: pointer bit offset '8' cannot cast into pointer bit offset '0'