2 ! PR48351 - automatic (re)allocation of allocatable components of class objects
4 ! Contributed by Nasser M. Abbasi on comp.lang.fortran
10 real, allocatable :: u(:)
16 subroutine make(this,u)
19 real, intent(in) :: u(:)
20 this%u = u(int (u)) ! The failure to allocate occurred here.
21 if (.not.allocated (this%u)) STOP 1
26 real, allocatable :: disp (:)
27 if (allocated (this%u)) disp = this%u
35 real, allocatable :: u(:)
38 if (any (int (o%disp()) .ne. [1,2,3,4])) STOP 2
41 if (any (int (o%disp()) .ne. [1,2])) STOP 3