aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-02-28 00:22:53 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-02-28 00:22:53 -0500
commit1b8a241f6fd1ac8d42965c6aaaf4934de565b2b2 (patch)
treefe663d430faa66ee31ccd815cc370cd25d1ac9ca /test
parent0f449a3ec180f710f8b54023d2c3b3dffcce5ec8 (diff)
parent90598b4631e3b68565c7d62102a9e4615514a721 (diff)
downloadzig-1b8a241f6fd1ac8d42965c6aaaf4934de565b2b2.tar.gz
zig-1b8a241f6fd1ac8d42965c6aaaf4934de565b2b2.zip
Merge branch 'fix795' of https://github.com/bnoordhuis/zig into bnoordhuis-fix795
Diffstat (limited to 'test')
-rw-r--r--test/compile_errors.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 940125711b..a3ac4e2344 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -3090,4 +3090,16 @@ pub fn addCases(cases: &tests.CompileErrorContext) void {
,
".tmp_source.zig:11:20: error: runtime cast to union 'Value' which has non-void fields",
".tmp_source.zig:3:5: note: field 'A' has type 'i32'");
+
+ cases.add("self-referencing function pointer field",
+ \\const S = struct {
+ \\ f: fn(_: S) void,
+ \\};
+ \\fn f(_: S) void {
+ \\}
+ \\export fn entry() void {
+ \\ var _ = S { .f = f };
+ \\}
+ ,
+ ".tmp_source.zig:4:9: error: type 'S' is not copyable; cannot pass by value");
}