summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/realloc_on_assign_27.f08
blob: 9a786299565aea7484fbcdd2e878d8c378399cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
! { dg-do run }

  type :: t
    integer :: i
  end type

  type, extends(t) :: r
    real :: r
  end type

  class(t), allocatable :: x
  type(r) :: y = r (3, 42)

  x = y
  if (x%i /= 3) call abort()
  select type(x)
    class is (r)
      if (x%r /= 42.0) call abort()
    class default
      call abort()
  end select
end