| author | |
| committer | |
| log | e9a6197a8ea38c228e2683d82cfbdbad8e7d912a |
| tree | a35378edac7d399d7752e987b3cd55806e391666 |
| parent | 33644546a0c17e48f0a3f7b59d9bd0a749666173 |
| signature |
2 files changed, 15 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | ... | @@ -25573,7 +25573,7 @@ fn explainWhyTypeIsNotExtern( |
| 25573 | 25573 | try mod.errNoteNonLazy(src_loc, msg, "pointer to comptime-only type '{}'", .{pointee_ty.fmt(sema.mod)}); |
| 25574 | 25574 | try sema.explainWhyTypeIsComptime(msg, src_loc, ty); |
| 25575 | 25575 | } |
| 25576 | try sema.explainWhyTypeIsNotExtern(msg, src_loc, pointee_ty, position); | |
| 25576 | try sema.explainWhyTypeIsNotExtern(msg, src_loc, pointee_ty, .other); | |
| 25577 | 25577 | } |
| 25578 | 25578 | }, |
| 25579 | 25579 | .Void => try mod.errNoteNonLazy(src_loc, msg, "'void' is a zero bit type; for C 'void' use 'anyopaque'", .{}), |
test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig created+14| ... | ... | @@ -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 |