test/compile_errors.zig: add regression test for ziglang/zig#532 ;

This commit is contained in:
kristopher tate 2019-04-07 10:36:10 +09:00
parent 627b52fe65
commit fae0c35195
No known key found for this signature in database
GPG Key ID: AEE8EEAD03E20816

View File

@ -2,6 +2,21 @@ const tests = @import("tests.zig");
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 {