linked lists/trees with type-bound procedures

Mark Rashid mmrashid@ucdavis.edu
Tue Aug 24 15:35:00 GMT 2010


Under gfortran 4.5, there appears to be a problem defining derived types
that have type-bound procedures, and that also have one or more pointers to
components of the same type being defined (i.e. "link pointers").  (This
you need to do if you want a linked list or search tree whose nodes are
objects with type-bound procedures.)  In the derived-type definition, if
you specify the pointer to the type being defined using CLASS (as is
appropriate), then gfortran throws an error on compilation, saying that the
"passed-object dummy argument of '[type-bound-proc]' must not be POINTER."
 This, even though the argument of the type-bound procedure in question is
declared in the procedure using CLASS (per the standard) but without the
POINTER attribute.  Changing from CLASS to TYPE for the link pointer in the
original derived-type definition eliminates this compilation error, but
then causes other untold problems.  By my reading of the standard (but
please correct if you believe otherwise), it should be possible to define
link pointers in derived types using CLASS, and this is in fact appropriate
if the derived type has type-bound procedures.  Will be grateful for any help.



More information about the Fortran mailing list