On Mon, Aug 7, 2017 at 10:55 AM, Anton Shterenlikht <[log in to unmask]> wrote:
> Is this program conforming?
>..
>
> I think yes.
> ..
If I understand the standard correctly, then no it's not conforming.
There is no procedure corresponding to the kind type declared in the
caller of the object that is the effective argument in procedure s.
You may consider a generic interface with overloaded procedures of
each kind type parameters that the module intends to support:
---- begin code snippet ----
module m
implicit none
type t1( mass_kind, nlen, number )
integer, kind :: mass_kind = kind(1.0)
integer, len :: nlen=1, number=1
character( len=nlen ) :: cname( number )
real( kind=mass_kind ) :: mass_g
end type t1
type, extends( t1 ) :: t2
real :: length_mm
end type t2
type, extends( t2 ) :: t3( slen )
integer, len :: slen
character( len=slen ) :: lname( number )
end type t3
interface s
module procedure s_real
module procedure s_double
end interface
contains
subroutine s_real( amph )
class( t1(mass_kind=kind(1.0),nlen=*,number=*) ) :: amph(:)
include 's.f90' ! elided are the statements in this include file
end subroutine s_real
subroutine s_double( amph )
class( t1(mass_kind=kind(1d0),nlen=*,number=*) ) :: amph(:)
include 's.f90' ! elided are the statements in this include file
end module m
---- end code snippet ----
Compiler 1 should then accept the above code, don't know about compiler 2.
What happened with compiler 3 this time around!!
Vipul
|