[Bug fortran/56500] [OOP] "IMPLICIT CLASS(...)" wrongly rejected

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Mar 2 00:07:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56500

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-02 00:06:45 UTC ---
The problem seems to be that "class_ok" is not true; the reason seems to be
that gfc_build_class_symbol does not get called.

I am not sure, when it has to be called but it currently fails for:

  implicit class(*) (a-z)
  allocatable :: foo
  end
and for
  subroutine foo(x)
  implicit class(*) (a-z)
  end

The error message is printed in resolve.c's resolve_fl_var_and_proc:

  /* Constraints on polymorphic variables.  */
...
      if (!sym->attr.class_ok && !sym->attr.use_assoc && !sym->assoc)
        {
          gfc_error ("CLASS variable '%s' at %L must be dummy, allocatable "
                     "or pointer", sym->name, &sym->declared_at);


gfc_build_class_symbol is currently only called in decl.c via "build_struct"
and via attr_decl1. One probably has to call it in symbol.c's 
gfc_set_default_type



More information about the Gcc-bugs mailing list