ieee_9.f90: XFAIL on arm*-*-gnueabi[hf].
[official-gcc.git] / gcc / testsuite / gfortran.dg / unlimited_polymorphic_25.f90
blob75fde896bcc138bb3ee96b1e458cc6f273f79ed1
1 ! { dg-do run }
3 ! Test contributed by Valery Weber <valeryweber@hotmail.com>
5 module mod
7 TYPE, PUBLIC :: base_type
8 END TYPE base_type
10 TYPE, PUBLIC :: dict_entry_type
11 CLASS( * ), ALLOCATABLE :: key
12 CLASS( * ), ALLOCATABLE :: val
13 END TYPE dict_entry_type
16 contains
18 SUBROUTINE dict_put ( this, key, val )
19 CLASS(dict_entry_type), INTENT(INOUT) :: this
20 CLASS(base_type), INTENT(IN) :: key, val
21 INTEGER :: istat
22 ALLOCATE( this%key, SOURCE=key, STAT=istat )
23 end SUBROUTINE dict_put
24 end module mod
26 program test
27 use mod
28 type(dict_entry_type) :: t
29 type(base_type) :: a, b
30 call dict_put(t, a, b)
32 if (.NOT. allocated(t%key)) STOP 1
33 select type (x => t%key)
34 type is (base_type)
35 class default
36 STOP 2
37 end select
38 deallocate(t%key)
39 end