FunctionType.predicate]>, "any addressable">;
def ArrayOrBoxOrRecord : TypeConstraint<Or<[fir_SequenceType.predicate,
- fir_BoxType.predicate, fir_RecordType.predicate]>,
+ IsBaseBoxTypePred, fir_RecordType.predicate]>,
"fir.box, fir.array or fir.type">;
! CHECK-LABEL: test_allocate_unlimited_polymorphic_non_derived
! CHECK-NOT: _FortranAPointerNullifyDerived
! CHECK: fir.call @_FortranAPointerAllocate
+
+ function test_fct_ret_class()
+ class(p1), pointer :: test_fct_ret_class
+ end function
+
+ subroutine call_fct()
+ class(p1), pointer :: p
+ p => test_fct_ret_class()
+ end subroutine
+
+! CHECK-LABEL: func.func @_QMpolymorphic_testPtest_fct_ret_class() -> !fir.class<!fir.ptr<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>>
+! CHECK: return %{{.*}} : !fir.class<!fir.ptr<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>>
+
+! CHECK-lABEL: func.func @_QMpolymorphic_testPcall_fct()
+! CHECK: %[[RESULT:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>> {bindc_name = ".result"}
+! CHECK: %[[CALL_RES:.*]] = fir.call @_QMpolymorphic_testPtest_fct_ret_class() : () -> !fir.class<!fir.ptr<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>>
+! CHECK: fir.save_result %[[CALL_RES]] to %[[RESULT]] : !fir.class<!fir.ptr<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>>, !fir.ref<!fir.class<!fir.ptr<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>>>
+
end module