(j3.2006) Is there something wrong with this?
Thu Oct 29 20:02:21 EDT 2015
This is close to Interp F90/0145 (I think the number is right).
> On Oct 29, 2015, at 17:25 , Van Snyder <Van.Snyder at JPL.NASA.GOV> wrote:
> I think the following module ought to be OK:
> module M
> type, abstract :: T1
> end type T1
> type, extends(t1) :: T2
> end type T2
> class(t1) function F1 ( ) result ( R1 )
> allocatable :: R1
> allocate ( t2 :: r1 )
> select type ( r1 )
> type is ( t2 )
> r1 = t2()
> end select
> end function F1
> function F2 ( ) result ( R2 )
> class(t1), allocatable :: R2
> allocate ( t2 :: r2 )
> r2 = t2()
> end function F2
> end module M
> None of the processors I have will compile it. They complain in F1 that
> the type of R1 is not T2, and that R1 is not polymorphic in the SELECT
> TYPE statement. One of them complains about the assignment "r2 = t2()"
> in F2.
> Is it defective?
> I believe the SELECT TYPE construct ought not to be needed. Indeed, I
> believe the ALLOCATE is also not needed, but it illustrates a problem
> that all my processors complain about in F1 (but which does not occur in
> 220.127.116.11p3 says the type and type parameters of the result of the
> function may be specified by a type specification in the FUNCTION
> statement. It is silent concerning whether the result is or is not
> polymorphic. Is R1 polymorphic? I believe so.
> J3 mailing list
> J3 at mailman.j3-fortran.org
More information about the J3