aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
authorBogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>2023-11-05 13:36:06 +0300
committerGitHub <noreply@github.com>2023-11-05 12:36:06 +0200
commite9a6197a8ea38c228e2683d82cfbdbad8e7d912a (patch)
treea35378edac7d399d7752e987b3cd55806e391666 /test/cases/compile_errors
parent33644546a0c17e48f0a3f7b59d9bd0a749666173 (diff)
downloadzig-e9a6197a8ea38c228e2683d82cfbdbad8e7d912a.tar.gz
zig-e9a6197a8ea38c228e2683d82cfbdbad8e7d912a.zip
Sema: fix error notes with wrong extern type
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig b/test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig
new file mode 100644
index 0000000000..ead75eb43e
--- /dev/null
+++ b/test/cases/compile_errors/extern_function_with_unspecified_calling_convention.zig
@@ -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