aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-04-07 15:32:02 -0400
committerGitHub <noreply@github.com>2019-04-07 15:32:02 -0400
commit6715c54cc641e61405bb72d286fe2cf560447b56 (patch)
tree6b62ce5b82c65595a13f6cf93335a4bfaa73dc8e /test/compile_errors.zig
parent7c38651a65b48b8cc683bc31a40952d9b469ec4d (diff)
parentfae0c35195076c8bce9da3528ce8d1959902ca06 (diff)
downloadzig-6715c54cc641e61405bb72d286fe2cf560447b56.tar.gz
zig-6715c54cc641e61405bb72d286fe2cf560447b56.zip
Merge pull request #2205 from kristate/zig-backport-issue532
stage1: create ir.cpp specific `analyze_type_expr`
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index a31605b02a..0d30bd7175 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -3,6 +3,21 @@ const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "Generic function where return type is self-referenced",
+ \\fn Foo(comptime T: type) Foo(T) {
+ \\ return struct{ x: T };
+ \\}
+ \\export fn entry() void {
+ \\ const t = Foo(u32) {
+ \\ .x = 1
+ \\ };
+ \\}
+ ,
+ "tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches",
+ "tmp.zig:1:29: note: called from here",
+ );
+
+ cases.add(
"@ptrToInt 0 to non optional pointer",
\\export fn entry() void {
\\ var b = @intToPtr(*i32, 0);