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(
2567525675
2567625676 .@"opaque",
2567725677 .bool,
25678 .float,
2567925678 .@"anyframe",
2568025679 => unreachable, // these *are* allowed
2568125680
......@@ -25684,6 +25683,7 @@ pub fn explainWhyTypeIsNotExtern(
2568425683 try sema.errNote(src_loc, msg, "SPIR-V runtime arrays must be the last field of an extern struct", .{});
2568525684 },
2568625685
25686 .float => try sema.errNote(src_loc, msg, "'{f}' is not extern compatible on this target", .{ty.fmt(pt)}),
2568725687 .pointer => if (ty.isSlice(zcu)) {
2568825688 try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});
2568925689 } else {
src/Type.zig+4-1
......@@ -3122,7 +3122,6 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool
31223122
31233123 .@"opaque",
31243124 .bool,
3125 .float,
31263125 .@"anyframe",
31273126 => true,
31283127
......@@ -3144,6 +3143,10 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool
31443143 24, 48 => zcu.getTarget().cpu.arch == .ez80,
31453144 else => false,
31463145 },
3146 .float => switch (ty.floatBits(zcu.getTarget())) {
3147 else => true,
3148 80 => zcu.getTarget().cTypeBitSize(.longdouble) == 80,
3149 },
31473150 .@"fn" => {
31483151 if (position != .other) return false;
31493152 return validateExternCallconv(ty.fnCallingConvention(zcu));