2 ! Further test of typebound defined assignment
10 generic
:: assignment(=)=>assign0
13 type(component
) :: foo(2)
15 type, extends(parent
) :: child
19 elemental
subroutine assign0(lhs
,rhs
)
20 class(component
), intent(INout
) :: lhs
21 class(component
), intent(in
) :: rhs
32 generic
:: assignment(=)=>assign1
35 type(component1
) :: foo
37 type, extends(parent1
) :: child1
41 impure elemental
subroutine assign1(lhs
,rhs
)
42 class(component1
), intent(out
) :: lhs
43 class(component1
), intent(in
) :: rhs
53 type(child
) :: infant(2)
54 type(parent
) :: dad
, mum
55 type(child1
) :: orphan(5)
56 type(child1
), allocatable
:: annie(:)
59 dad
= parent ([component (3), component (4)])
60 mum
= parent ([component (5), component (6)])
61 infant
= [child(dad
, 999), child(mum
, 9999)] ! { dg-warning "multiple part array references" }
63 ! Check that array sections are OK
66 orphan(i
:j
) = child1(component1(777), 1)
67 if (any (orphan
%parent1
%foo
%i
.ne
. [0,0,30,30,0])) call abort
68 if (any (orphan
%j
.ne
. [7,7,1,1,7])) call abort
70 ! Check that allocatable lhs's work OK.
71 annie
= [(child1(component1(k
), 2*k
), k
= 1,3)]
72 if (any (annie
%parent1
%foo
%i
.ne
. [30,30,30])) call abort
73 if (any (annie
%j
.ne
. [2,4,6])) call abort