The Fortran 2003 standard Section C.1.6 allows a generic procedure to have the
same name as a type , but gfotran gives "Error: DERIVED attribute of 'foo'
conflicts with PROCEDURE attribute at (1)" on the following code:

module foo_module
  type foo
    integer :: bar
  end type
  interface foo
    procedure constructor
  end interface
contains
  type(foo) function constructor()
    constructor%bar = 1
  end function
end module

I use this style throughout a textbook I'm writing because it seems like a
natural way to extend the intrinsic structure constructor syntax.  A more
extensive example of this technique is also in Figure 17.1 of Metcalf, Reid &
Cohen.

Damian


-- 
           Summary: Error on generic name equivalent to type name in same
                    module
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: damian at rouson dot net
 GCC build triplet: Using built-in specs. Target: i386-apple-darwin8.10.1
                    Configured
  GCC host triplet: Using built-in specs. Target: i386-apple-darwin8.10.1
                    Configured
GCC target triplet: Using built-in specs. Target: i386-apple-darwin8.10.1
                    Configured


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

Reply via email to