Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

INTENT in overriding TBPs

1 view
Skip to first unread message

sfilippone

unread,
Mar 3, 2011, 12:44:42 PM3/3/11
to
Hello,
I think the following code is invalid. NAG, IBM XLF, Intel and
pathscale agree with me;
cray, pgi, and gnu accept it.
Comments from the language lawyers?
Thannks
Salvatore
------------------------------try_ext.f90 ----------------------
module foo_mod
type foo
integer :: i=0
contains
procedure, pass(f) :: bar => base_bar
end type foo

contains
subroutine base_bar(f,j,k)
class(foo), intent(inout) :: f
integer, intent(in) :: j
integer, intent(inout) :: k

f%i = max(f%i,j)
k = k + f%i
end subroutine base_bar
end module foo_mod

module extfoo_mod
use foo_mod

type, extends(foo) :: extfoo

contains
procedure, pass(f) :: bar => ext_bar
end type extfoo

contains
subroutine ext_bar(f,j,k)
class(extfoo), intent(inout) :: f
integer, intent(inout) :: j
integer, intent(inout) :: k

f%i = max(f%i,j)
j = f%i
k = k + f%i
end subroutine ext_bar
end module extfoo_mod

0 new messages