Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_47.f90
blob43084f67e40141541a20058164ff5e3a83a2b14c
1 ! { dg-do run }
2 ! Tests the fix for PR68196
4 ! Contributed by Damian Rouson <damian@sourceryinstitute.org>
6 type AA
7 integer :: i
8 procedure(foo), pointer :: funct
9 end type
10 class(AA), allocatable :: my_AA
11 type(AA) :: res
13 allocate (my_AA, source = AA (1, foo))
15 res = my_AA%funct ()
17 if (res%i .ne. 3) call abort
18 if (.not.associated (res%funct)) call abort
19 if (my_AA%i .ne. 4) call abort
20 if (associated (my_AA%funct)) call abort
22 contains
23 function foo(A)
24 class(AA), allocatable :: A
25 type(AA) foo
27 if (.not.allocated (A)) then
28 allocate (A, source = AA (2, foo))
29 endif
31 select type (A)
32 type is (AA)
33 foo = AA (3, foo)
34 A = AA (4, NULL ())
35 end select
36 end function
37 end