summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pr62125.f90
blob: b72fdf6fe6a1e2e41c40dde64fa9b43112a508cd (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
29
30
31
32
! { dg-do run }
! PR62125  Nested select type not accepted (rejects valid) 
module m
 implicit none
 type, abstract :: t1
  logical :: l
 end type t1
 type, extends(t1), abstract :: t2
  integer :: i
 end type t2
 type, extends(t2) :: t3
  real :: x
 end type t3
contains
 subroutine s(u)
  class(t1), intent(in) :: u
  if(.not.u%l) STOP 1
   select type(u); class is(t2)
     if(u%i.ne.2) STOP 2
     select type(u); class is(t3)
       if(u%x.ne.3.5) STOP 3
     end select
   end select
 end subroutine s
end module m

program p
 use m
 implicit none
 type(t3) :: var = t3( l=.true. , i=2 , x=3.5 )
 call s(var)
end program p