[Bug fortran/52010] [OOP] Intrinsic assignment of a CLASS to a TYPE
pault at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 30 03:12:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52010
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |damian at sourceryinstitute dot or
| |g
--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
In fact, it appears that both tests are fixed by the current patch in PR63205.
This works fine:
module m_test
implicit none
type ta
private
integer :: i = 99
contains
procedure :: suba
end type ta
type tb
private
class(ta), pointer :: pa => null()
contains
procedure :: disp
end type tb
contains
function suba( a, v) result(b)
class(ta), target, intent(inout) :: a
type(tb) :: b
integer :: v
a%i = v
b%pa => a
end function suba
subroutine disp (arg)
class(tb), intent(in) :: arg
print *, arg%pa%i
end subroutine
end module m_test
use m_test
class(ta), allocatable :: tgt
type(tb) :: PTR
allocate (tgt)
ptr = tgt%suba(42)
call ptr%disp
deallocate (tgt)
end
Paul
More information about the Gcc-bugs
mailing list