diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index b854115b4b..3812fb82e7 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -615,6 +615,7 @@ RUN(NAME structs_30 LABELS cpython llvm c) RUN(NAME structs_31 LABELS cpython llvm c) RUN(NAME structs_32 LABELS cpython llvm c) RUN(NAME structs_33 LABELS cpython llvm c) +RUN(NAME structs_34 LABELS cpython llvm c) RUN(NAME symbolics_01 LABELS cpython_sym c_sym) RUN(NAME symbolics_02 LABELS cpython_sym c_sym) diff --git a/integration_tests/structs_34.py b/integration_tests/structs_34.py new file mode 100644 index 0000000000..f69d6d5f6a --- /dev/null +++ b/integration_tests/structs_34.py @@ -0,0 +1,24 @@ +from lpython import packed, dataclass, ccallable, i32, ccallback + +@ccallable +@packed +@dataclass +class struct_0: + val_0 : i32 = 613 + +@ccallable +@packed +@dataclass +class struct_1: + val_1 : struct_0 = struct_0() + +def print_val_0_in_struct_0(struct_0_instance : struct_0) -> i32: + print(struct_0_instance.val_0) + return 0 + +@ccallback +def entry_point() -> i32: + struct_1_instance : struct_1 = struct_1() + return print_val_0_in_struct_0(struct_1_instance.val_1) + +assert entry_point() == 0