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

generic type bound procedure

19 views
Skip to first unread message

sfilippone

unread,
Nov 14, 2011, 8:36:06 AM11/14/11
to
Hello,
I have found an interesting error message in one particular compiler.
Consider the following code:
----------------------------------------------------------
module foo_mod
type bar
integer, allocatable :: i(:)
contains
procedure, pass(this) :: set_scal
generic, public :: set => set_vect, set_scal
procedure, pass(this) :: set_vect
end type bar

contains
subroutine set_scal(this,val)
class(bar) :: this
integer :: val

if (allocated(this%i)) this%i(:) = val
end subroutine set_scal
subroutine set_vect(this,val)
class(bar) :: this
integer :: val(:)

this%i = val
end subroutine set_vect
end module foo_mod
--------------------------------------------------------------
Question is: is there a requirement for the specific bindings in the
CONTAINS section of the derived data type to be specified before the
GENERIC binding that references them? In other words, is the above
legal (with generic coming before the second SET specific?), even
admittedly a bit strange?
One particular compiler refuses to resolve the generic if I do not
switch the statement order, whereas the others I tried allow me.

Thanks
Salvatore

dam...@rouson.net

unread,
Mar 13, 2012, 2:37:53 PM3/13/12
to
I also have some interest in this question. Only one of four compilers tried complains about the ordering of the GENERIC binding relative to the specific binding to which the GENERIC points. Does anyone know if any part of the standard addresses this issue?
0 new messages