fix compile crash when leaving out for loop parameter

This commit is contained in:
Andrew Kelley
2016-09-22 10:40:05 -04:00
parent 7aeca9bfed
commit c64f6f9503
2 changed files with 13 additions and 2 deletions

View File

@@ -1495,6 +1495,12 @@ pub fn f() {
add_compile_fail_case("main function with bogus args type", R"SOURCE(
pub fn main(args: [][]bogus) -> %void {}
)SOURCE", 1, ".tmp_source.zig:2:23: error: use of undeclared identifier 'bogus'");
add_compile_fail_case("main function with bogus args type", R"SOURCE(
fn foo(blah: []u8) {
for (blah) { }
}
)SOURCE", 1, ".tmp_source.zig:3:16: error: for loop expression missing element parameter");
}
//////////////////////////////////////////////////////////////////////////////