PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / unlimited_polymorphic_6.f90
bloba64f4e393e248eeea470cb7a70e2ba3865402d2e
1 ! { dg-do run }
3 ! PR fortran/55763
5 ! Contributed by Reinhold Bader
7 module mod_alloc_scalar_01
8 contains
9 subroutine construct(this)
10 class(*), allocatable, intent(out) :: this
11 integer :: this_i
12 this_i = 4
13 allocate(this, source=this_i)
14 end subroutine
15 end module
17 program alloc_scalar_01
18 use mod_alloc_scalar_01
19 implicit none
20 class(*), allocatable :: mystuff
22 call construct(mystuff)
23 call construct(mystuff)
25 select type(mystuff)
26 type is (integer)
27 if (mystuff == 4) then
28 ! write(*,*) 'OK'
29 else
30 call abort()
31 ! write(*,*) 'FAIL 1'
32 end if
33 class default
34 call abort()
35 ! write(*,*) 'FAIL 2'
36 end select
37 end program