2 ! TODO: make runtime testcase once bug is fixed
6 ! Based on an example by Thomas Henlich
11 integer, dimension(:), allocatable :: i
14 type(tx), pointer :: x
23 class(t), target :: this
24 type(tx), target :: that
26 this%x => this%find_x(that, .true.)
27 if (associated (this%x)) call abort()
28 this%x => this%find_x(that, .false.)
29 if(any (this%x%i /= [5, 7])) call abort()
30 if (.not.associated (this%x,that)) call abort()
32 if (associated (this%x,that)) call abort()
33 if (allocated(this%x%i)) call abort()
34 this%x = this%find_x(that, .false.)
36 if(any (this%x%i /= [5, 7])) call abort() ! FAILS
38 if (allocated (this%y%i)) call abort()
39 this%y = this%find_y() ! FAILS
40 if (.not.allocated (this%y%i)) call abort()
41 if(any (this%y%i /= [6, 8])) call abort()
43 function find_x(this, that, l_null)
44 class(t), intent(in) :: this
45 type(tx), target :: that
46 type(tx), pointer :: find_x
55 function find_y(this) result(res)
56 class(t), intent(in) :: this
57 type(tx), allocatable :: res
68 ! { dg-final { cleanup-modules "class_t" } }