F2k3には仮想デストラクタがないことを正しく理解していますか?
stefanos-imac:oop borini$ cat a.f90
module AModule
type :: AType
contains
final :: A_dtor
end type
contains
subroutine A_dtor(self)
type(AType), intent(inout) :: self
print *, "A_dtor"
end subroutine
end
stefanos-imac:oop borini$ cat b.f90
module BModule
use AModule
type,extends(AType) :: BType
contains
final :: B_dtor
end type
contains
subroutine B_dtor(self)
type(BType), intent(inout) :: self
print *, "B_dtor"
end subroutine
end
stefanos-imac:oop borini$ cat x.f90
program x
use AModule
use BModule
class (AType), pointer :: baseptr
type(BType), pointer :: derivedptr
allocate(derivedptr)
baseptr => derivedptr
deallocate(baseptr)
end program
stefanos-imac:oop borini$ ./a.out
A_dtor
forrtl: severe (173): A pointer passed to DEALLOCATE points to an array that cannot be deallocated
Image PC Routine Line Source
a.out 0000000108A731F4 Unknown Unknown Unknown
a.out 0000000108A7198E Unknown Unknown Unknown
a.out 0000000108A4D791 Unknown Unknown Unknown
a.out 0000000108A2283E Unknown Unknown Unknown
a.out 0000000108A3B930 Unknown Unknown Unknown
a.out 0000000108A1EF10 Unknown Unknown Unknown
a.out 0000000108A0A104 Unknown Unknown Unknown
a.out 0000000108A09F0C Unknown Unknown Unknown
a.out 0000000108A09EC4 Unknown Unknown Unknown