diff --git a/backend.native/tests/Makefile b/backend.native/tests/Makefile index 23c2935b307..9ad05e228fa 100644 --- a/backend.native/tests/Makefile +++ b/backend.native/tests/Makefile @@ -1,10 +1,11 @@ TESTS := sum \ sum_foo_bar \ - arithmetic + arithmetic \ + initialization BIN_TESTS=$(foreach t, ${TESTS},${t}_test) -VPATH=codegen/function:${TOP}/runtime/build +VPATH=codegen/function:codegen/object:${TOP}/runtime/build LLC=llc-mp-3.8 CC=clang-mp-3.8 diff --git a/backend.native/tests/codegen/object/initialization-test.c b/backend.native/tests/codegen/object/initialization-test.c new file mode 100644 index 00000000000..86646705db9 --- /dev/null +++ b/backend.native/tests/codegen/object/initialization-test.c @@ -0,0 +1,10 @@ +extern void *resolve_symbol(const char*); + +int +run_test() { + int (*foo)(int, int) = resolve_symbol("kfun:foo"); + + if (foo(2, 3) != 2) return 1; + + return 0; +} diff --git a/backend.native/tests/codegen/object/initialization.kt b/backend.native/tests/codegen/object/initialization.kt new file mode 100644 index 00000000000..6507fa2d7da --- /dev/null +++ b/backend.native/tests/codegen/object/initialization.kt @@ -0,0 +1,10 @@ +open class A(val a:Int, val b:Int) + +open class B(val c:Int, d:Int):A(c, d) + +//class C():B(42) + +fun foo(i:Int, j:Int):Int { + val b = B(i, j) + return b.c +} \ No newline at end of file