aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/PR100245.f90
blob: 07c1f7b3a1ce011df977e900a8f571109b46afc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
! { dg-do run }
!
! Test the fix for PR100245
!

program main_p

  implicit none

  type :: foo_t
    integer :: a
  end type foo_t

  integer, parameter :: a = 42

  class(foo_t), allocatable :: val
  class(foo_t), allocatable :: rs1
  type(foo_t),  allocatable :: rs2

  allocate(val, source=foo_t(42))
  if (val%a/=a) stop 1
  rs1 = val
  if (rs1%a/=a) stop 2
  rs2 = val
  if (rs2%a/=a) stop 3
  deallocate(val, rs1, rs2)

end program main_p