2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / defined_assignment_10.f90
blob4385925dcd1f45fb864edafc86aa2aaa0b5825ba
1 ! { dg-do run }
3 ! PR fortran/57697
5 ! Further test of typebound defined assignment
7 module m0
8 implicit none
9 type component
10 integer :: i = 42
11 contains
12 procedure :: assign0
13 generic :: assignment(=) => assign0
14 end type
15 type parent
16 type(component) :: foo
17 end type
18 contains
19 elemental subroutine assign0(lhs,rhs)
20 class(component), intent(INout) :: lhs
21 class(component), intent(in) :: rhs
22 lhs%i = 20
23 end subroutine
24 end module
26 program main
27 use m0
28 implicit none
29 type(parent), allocatable :: left
30 type(parent) :: right
31 ! print *, right%foo
32 left = right
33 ! print *, left%foo
34 if (left%foo%i /= 20) call abort()
35 end