diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 564381cd1a..dde3b68f21 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1467,6 +1467,18 @@ fn function_with_return_type_type() { ".tmp_source.zig:4:5: note: unable to evaluate this expression at compile time", ".tmp_source.zig:3:32: note: required to be compile-time function because of return type 'type'"); + add_compile_fail_case("non pure function required to be pure", R"SOURCE( +var a: i32 = 0; + +fn foo() { + @setFnStaticEval(this, true); + a = 1; +} + )SOURCE", 3, + ".tmp_source.zig:4:1: error: failed to evaluate function at compile time", + ".tmp_source.zig:6:5: note: unable to evaluate this expression at compile time", + ".tmp_source.zig:5:5: note: required to be compile-time function here"); + add_compile_fail_case("bogus method call on slice", R"SOURCE( fn f(m: []const u8) { m.copy(u8, self.list.items[old_len...], m);