-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sema: fix error notes with wrong extern type
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const Foo = extern struct { | ||
f: *const fn() void, | ||
}; | ||
|
||
pub fn entry() void { | ||
_ = (Foo{}).f; | ||
} | ||
|
||
// error | ||
// backend=stage2 | ||
// target=native | ||
// | ||
// :2:8: error: extern structs cannot contain fields of type '*const fn () void' | ||
// :2:8: note: extern function must specify calling convention |