Is this program conforming?
I think yes.
module m
implicit none
type amphibian
end type amphibian
type, extends( amphibian ) :: anura( k, nl )
integer, kind :: k=-10
integer, len :: nl=30
end type anura
type, extends( anura ) :: bufonidae
character( len= nl ) :: genus
end type bufonidae
type, extends( anura ) :: hylidae
character( len= nl ) :: genus
end type hylidae
interface s
module procedure s1
module procedure s2
module procedure s3
end interface s
contains
subroutine s1( a )
class( anura ) :: a
write (*,*) "Order: Anura, nothing else known"
end subroutine s1
subroutine s2( a )
class( bufonidae( k=111, nl=* ) ) :: a
write (*,*) a % genus
end subroutine s2
subroutine s3( a )
class( hylidae( k=3456, nl=* ) ) :: a
write (*,*) a % genus
end subroutine s3
end module m
program x
use m
implicit none
type( anura ) :: x1
type( bufonidae( k=111 ) ) :: x2
type( hylidae( k=3456 ) ) :: x3
x2 % genus = "Didynamipus sjostedti"
x3 % genus = "Cyclorana platycephala"
call s( x1 )
call s( x2 )
call s( x3 )
end program x
One compiler give the expected output:
Order: Anura, nothing else known
Didynamipus sjostedti
Cyclorana platycephala
Another compiler outputs only the first line,
i.e. no output from calls to subroutine s with
arguments x2 or x3.
Thanks
Anton
|