3 ! Check that reallocation of the lhs is done with the correct memory size.
10 procedure(base_add), deferred :: add
11 generic :: operator(+) => add
15 module function base_add(l, r) result(res)
16 class(base), intent(in) :: l
17 integer, intent(in) :: r
18 class(base), allocatable :: res
25 class(base), intent(inout), allocatable :: x
26 class(base), allocatable :: t
37 type, extends(base) :: extend
44 module function add(l, r) result(res)
45 class(extend), intent(in) :: l
46 integer, intent(in) :: r
47 class(base), allocatable :: res
52 error stop "Unkown class to add to."
61 class(base), allocatable :: obj
66 if (obj%i /= 42) error stop
68 error stop "Result's type wrong."
70 end program test_poly_ass