(j3.2006) question about generic resolution
Bill Long
longb at cray.com
Tue Mar 23 18:14:47 EDT 2010
In f08 at [286:12.4.3.4.5p3] we allow (as a new feature) a dummy
argument with the ALLOCATABLE attribute to be distinguishable from a
dummy argument with the POINTER attribute. Thus, I would conclude that
this generic interface is OK:
interface sub
subroutine suba (a)
real,allocatable :: a(:)
end subroutine suba
subroutine subp (a)
real,pointer,intent(in) :: a(:)
end subroutine subp
end interface sub
This extension made perfect sense in the f03 context of pointer dummy
shall correspond to pointer actual. However, at [296:12.5.2.7p2] we
have another new feature that allows a pointer dummy to correspond to a
non-pointer actual. So, assuming the interface for sub above, how is
the following resolved:
real,allocatable,target :: actual(:)
allocate(actual(100))
call sub (actual)
Either of the specific interfaces appears to be viable as a callee. I
assume that we intend that suba is called. However, I don't see anything
in [303:12.5.5.2] (resolving generics) that says this. Did these two
new features just fly by each other, or (hopefully) did I miss some part
of the text that points out where the above example goes wrong, or is
disambiguated.
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list