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>
4!
5module a_mod
6  type :: a
7    integer :: i = 99
8  contains
9     procedure :: a_ass
10     generic :: assignment(=) => a_ass
11  end type a
12
13  type c
14    type(a) :: ta
15  end type c
16
17  type :: b
18    type(c) :: tc
19  end type b
20
21contains
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
27end module a_mod
28
29program 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
35end program assign
36