aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-09-26 20:00:28 -0400
committerAndrew Kelley <superjoe30@gmail.com>2016-09-26 20:01:42 -0400
commit7ce7e2c9d1d43886c93f34b67d32ef77cc0d8a6e (patch)
treeb983cf44e18da510aa9b9bb02953f02af076c410 /test/run_tests.cpp
parent7f4d4bdb3f8c4ac0c368074c111d5455ea6c8ade (diff)
downloadzig-7ce7e2c9d1d43886c93f34b67d32ef77cc0d8a6e.tar.gz
zig-7ce7e2c9d1d43886c93f34b67d32ef77cc0d8a6e.zip
emit error for extern function
with byvalue return value or parameter. currently we don't codegen byvalue parameters or return values correctly for C compatibilty functions so instead of generating incorrect code, we emit a compile error. eventually we'll support this feature and remove the compile error. See #180
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index e909c171b9..aeab7566ab 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -884,10 +884,17 @@ var a : i32 = 1;
var a : i32 = 2;
)SOURCE", 1, ".tmp_source.zig:3:1: error: redeclaration of variable 'a'");
- add_compile_fail_case("byvalue struct on exported functions", R"SOURCE(
+ add_compile_fail_case("byvalue struct parameter in exported function", R"SOURCE(
struct A { x : i32, }
export fn f(a : A) {}
- )SOURCE", 1, ".tmp_source.zig:3:13: error: byvalue struct parameters not yet supported on extern functions");
+ )SOURCE", 1, ".tmp_source.zig:3:13: error: byvalue types not yet supported on extern function parameters");
+
+ add_compile_fail_case("byvalue struct return value in exported function", R"SOURCE(
+struct A { x: i32, }
+export fn f() -> A {
+ A {.x = 1234 }
+}
+ )SOURCE", 1, ".tmp_source.zig:3:18: error: byvalue types not yet supported on extern function return values");
add_compile_fail_case("duplicate field in struct value expression", R"SOURCE(
struct A {