Hi all,
I put a small example together to show a behavior i don't understand, hoping for some explanation here.
This code end up with the following in intel 15 version, the copy is not made despite the select type. Also Is the extends_type_of results correct ?
Thanks.
class cm2 is type tm T class cm2 is class cm T class cm2 is type tc T class cm2 is class cc T cm2=cm 10 1
With gfortran 4.9.1 I have :
class cm2 is type tm T class cm2 is class cm T class cm2 is type tc F class cm2 is class cc T cm2=cm 10 1
program toto
implicit none
type mother
integer :: i
end type mother
type,extends(mother) :: child
end type child
type(mother) :: tm
type(child) :: tc
class(mother),allocatable :: cm,cm2
class(child),allocatable :: cc
allocate(cm)
allocate(child::cm2)
cm%i=10
cm2%i=1
select type (cm2)
type is (mother)
cm2=cm
end select
print *,'class cm2 is type tm',extends_type_of(cm2,tm)
print *,'class cm2 is class cm',extends_type_of(cm2,cm)
print *,'class cm2 is type tc',extends_type_of(cm2,tc)
print *,'class cm2 is class cc',extends_type_of(cm2,cc)
print *,'cm2=cm', cm%i,cm2%i
end program