From 04364c45cefbba9451af202ceab5ae528cc8bbaa Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 19 Apr 2016 19:37:25 -0700 Subject: fix casting with imported symbol not working --- test/run_tests.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/run_tests.cpp') diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 3d3d029387..6a3528e906 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1128,7 +1128,7 @@ fn foo(x: i32)(y: i32) -> i32 { return x + y; } fn test1(a: i32, b: i32) -> i32 { return foo(a)(b); } - )SOURCE", 1, ".tmp_source.zig:4:16: error: unable to resolve constant expression"); + )SOURCE", 1, ".tmp_source.zig:4:16: error: unable to evaluate constant expression"); add_compile_fail_case("goto jumping into block", R"SOURCE( fn f() { @@ -1200,6 +1200,15 @@ struct Foo { const a = Foo {.x = get_it()}; extern fn get_it() -> i32; )SOURCE", 1, ".tmp_source.zig:5:27: error: unable to evaluate constant expression"); + + add_compile_fail_case("non-const expression function call with struct return value outside function", R"SOURCE( +struct Foo { + x: i32, +} +const a = get_it(); +#static_eval_enable(false) +fn get_it() -> Foo { Foo {.x = 13} } + )SOURCE", 1, ".tmp_source.zig:5:17: error: unable to evaluate constant expression"); } ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3