add missing compile error for comptime continue inside runtime catch

See #2604
This commit is contained in:
Andrew Kelley
2019-07-02 21:14:42 -04:00
parent b84ff1dd32
commit 9daf0140e5
2 changed files with 20 additions and 3 deletions

View File

@@ -1148,6 +1148,22 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:4:5: error: no-inline call of inline function",
);
cases.add(
"comptime continue inside runtime catch",
\\export fn entry(c: bool) void {
\\ const ints = [_]u8{ 1, 2 };
\\ inline for (ints) |_| {
\\ bad() catch |_| continue;
\\ }
\\}
\\fn bad() !void {
\\ return error.Bad;
\\}
,
"tmp.zig:4:25: error: comptime control flow inside runtime block",
"tmp.zig:4:15: note: runtime block created here",
);
cases.add(
"comptime continue inside runtime switch",
\\export fn entry() void {