Dear Paul,
thanks for the updated patch. While reading your patch, I was wondering
whether the attached test case works or not.
Result: It does *not* print "Hello World" with neither gfortran nor
crayftn. If one changes in "m3" the declared type of "x" from "t" to
"t2", it shows "Hello World" with crayftn but still not with gfortran. I
believe that it should show the message in both cases.
I think the call should be done in the generated _copy function, which
brings me to the point about:
Paul Richard Thomas wrote:
Note that I have had to punt on defined assignments when there is more
than one part reference involved. The warning message suggests making
the loops explicit to make the defined assignment work.
If I recall correctly, Mikael was wondering whether this should be
handled by an elemental procedure. As _copy is an elemental procedure,
it might be used.
Tobias
module m
type t
end type t
end module m
module m2
use m
private
type, extends(t), public :: t2
contains
procedure :: assign1
generic :: assignment(=)=>assign1
end type t2
contains
subroutine assign1(lhs,rhs)
class(t2),intent(out) :: lhs
class(t2),intent(in) :: rhs
print *, 'Hello World'
end subroutine assign1
end module m2
module m3
use m
type t3
class(t), allocatable :: x
end type t3
end module m3
module m4
contains
subroutine init(y)
use m2
use m3
type(t3) :: y
allocate(t2 :: y%x)
end subroutine init
end module m4
use m3
use m4
type(t3) :: a, b
call init(a)
b = a
end