authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-07-17 11:33:42-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-07-27 14:35:12-04:00
log69dd10144fc723d8006f2e563fc3edd82ee4b368
tree48d71ac751a794a5f1e048c6de19dc62543c97ff
parent3e26b9e957887e55e99046e908bc07200140d3f8

Type: make `f80` not extern compatible on targets lacking such a type

Closes #35802

2 files changed, 5 insertions(+), 2 deletions(-)

src/Sema.zig+1-1
...@@ -25675,7 +25675,6 @@ pub fn explainWhyTypeIsNotExtern(...@@ -25675,7 +25675,6 @@ pub fn explainWhyTypeIsNotExtern(
2567525675
25676 .@"opaque",25676 .@"opaque",
25677 .bool,25677 .bool,
25678 .float,
25679 .@"anyframe",25678 .@"anyframe",
25680 => unreachable, // these *are* allowed25679 => unreachable, // these *are* allowed
2568125680
...@@ -25684,6 +25683,7 @@ pub fn explainWhyTypeIsNotExtern(...@@ -25684,6 +25683,7 @@ pub fn explainWhyTypeIsNotExtern(
25684 try sema.errNote(src_loc, msg, "SPIR-V runtime arrays must be the last field of an extern struct", .{});25683 try sema.errNote(src_loc, msg, "SPIR-V runtime arrays must be the last field of an extern struct", .{});
25685 },25684 },
2568625685
25686 .float => try sema.errNote(src_loc, msg, "'{f}' is not extern compatible on this target", .{ty.fmt(pt)}),
25687 .pointer => if (ty.isSlice(zcu)) {25687 .pointer => if (ty.isSlice(zcu)) {
25688 try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});25688 try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});
25689 } else {25689 } else {
src/Type.zig+4-1
...@@ -3122,7 +3122,6 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool...@@ -3122,7 +3122,6 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool
31223122
3123 .@"opaque",3123 .@"opaque",
3124 .bool,3124 .bool,
3125 .float,
3126 .@"anyframe",3125 .@"anyframe",
3127 => true,3126 => true,
31283127
...@@ -3144,6 +3143,10 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool...@@ -3144,6 +3143,10 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool
3144 24, 48 => zcu.getTarget().cpu.arch == .ez80,3143 24, 48 => zcu.getTarget().cpu.arch == .ez80,
3145 else => false,3144 else => false,
3146 },3145 },
3146 .float => switch (ty.floatBits(zcu.getTarget())) {
3147 else => true,
3148 80 => zcu.getTarget().cTypeBitSize(.longdouble) == 80,
3149 },
3147 .@"fn" => {3150 .@"fn" => {
3148 if (position != .other) return false;3151 if (position != .other) return false;
3149 return validateExternCallconv(ty.fnCallingConvention(zcu));3152 return validateExternCallconv(ty.fnCallingConvention(zcu));