sfilippone
unread,Nov 14, 2011, 8:36:06 AM11/14/11You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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