PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr68864.f90
blob151dfb2c2ffdf4cec6010b944f7041f3d23e02f8
1 ! { dg-do compile }
3 ! Contributed by Hossein Talebi <talebi.hossein@gmail.com>
6 Module part_base2_class
8 implicit none
10 type :: ty_moc1
11 integer l
12 end type ty_moc1
13 integer,parameter :: MAX_NUM_ELEMENT_TYPE=32
15 type :: ty_element_index2
17 class(ty_moc1),allocatable :: element
18 class(ty_moc1),allocatable :: element_th(:)
20 endtype ty_element_index2
22 type :: ty_part_base2
23 type(ty_element_index2)::element_index(MAX_NUM_ELEMENT_TYPE)
24 end type ty_part_base2
26 class(ty_part_base2),allocatable :: part_tmp_obj
28 End Module part_base2_class
30 use part_base2_class
31 allocate (part_tmp_obj)
32 allocate (part_tmp_obj%element_index(1)%element, source = ty_moc1(1))
33 allocate (part_tmp_obj%element_index(1)%element_th(1), source = ty_moc1(99))
34 allocate (part_tmp_obj%element_index(32)%element_th(1), source = ty_moc1(999))
36 do i = 1, MAX_NUM_ELEMENT_TYPE
37 if (allocated (part_tmp_obj%element_index(i)%element_th)) then
38 print *, i, part_tmp_obj%element_index(i)%element_th(1)%l
39 end if
40 end do
41 deallocate (part_tmp_obj)
43 end