111
|
1 ! { dg-do compile }
|
|
2 !
|
|
3 ! Contributed by Hossein Talebi <talebi.hossein@gmail.com>
|
|
4 !
|
|
5 !
|
|
6 Module part_base2_class
|
|
7
|
|
8 implicit none
|
|
9
|
|
10 type :: ty_moc1
|
|
11 integer l
|
|
12 end type ty_moc1
|
|
13 integer,parameter :: MAX_NUM_ELEMENT_TYPE=32
|
|
14
|
|
15 type :: ty_element_index2
|
|
16
|
|
17 class(ty_moc1),allocatable :: element
|
|
18 class(ty_moc1),allocatable :: element_th(:)
|
|
19
|
|
20 endtype ty_element_index2
|
|
21
|
|
22 type :: ty_part_base2
|
|
23 type(ty_element_index2)::element_index(MAX_NUM_ELEMENT_TYPE)
|
|
24 end type ty_part_base2
|
|
25
|
|
26 class(ty_part_base2),allocatable :: part_tmp_obj
|
|
27
|
|
28 End Module part_base2_class
|
|
29
|
|
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))
|
|
35
|
|
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)
|
|
42
|
|
43 end
|