2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / defined_assignment_4.f90
blobe7a1b8e0f6427cc2c1ece421fd676085e59c0985
1 ! { dg-do run }
2 ! Test the fix for PR46897. First patch did not run this case correctly.
3 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
5 module a_mod
6 type :: a
7 integer :: i = 99
8 contains
9 procedure :: a_ass
10 generic :: assignment(=) => a_ass
11 end type a
13 type c
14 type(a) :: ta
15 end type c
17 type :: b
18 type(c) :: tc
19 end type b
21 contains
22 elemental subroutine a_ass(out, in)
23 class(a), intent(INout) :: out
24 type(a), intent(in) :: in
25 out%i = 2*in%i
26 end subroutine a_ass
27 end module a_mod
29 program assign
30 use a_mod
31 type(b) :: tt
32 type(b) :: tb1
33 tt = tb1
34 if (tt%tc%ta%i .ne. 198) call abort
35 end program assign