Skip to content

Commit e9a6197

Browse files
authored
Sema: fix error notes with wrong extern type
1 parent 3364454 commit e9a6197

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Sema.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -25573,7 +25573,7 @@ fn explainWhyTypeIsNotExtern(
2557325573
try mod.errNoteNonLazy(src_loc, msg, "pointer to comptime-only type '{}'", .{pointee_ty.fmt(sema.mod)});
2557425574
try sema.explainWhyTypeIsComptime(msg, src_loc, ty);
2557525575
}
25576-
try sema.explainWhyTypeIsNotExtern(msg, src_loc, pointee_ty, position);
25576+
try sema.explainWhyTypeIsNotExtern(msg, src_loc, pointee_ty, .other);
2557725577
}
2557825578
},
2557925579
.Void => try mod.errNoteNonLazy(src_loc, msg, "'void' is a zero bit type; for C 'void' use 'anyopaque'", .{}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const Foo = extern struct {
2+
f: *const fn() void,
3+
};
4+
5+
pub fn entry() void {
6+
_ = (Foo{}).f;
7+
}
8+
9+
// error
10+
// backend=stage2
11+
// target=native
12+
//
13+
// :2:8: error: extern structs cannot contain fields of type '*const fn () void'
14+
// :2:8: note: extern function must specify calling convention

0 commit comments

Comments
 (0)