This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fails to compile the valid code


Uttam,


gfortran fails to compile the valid code (which has structure constructor and generic name)

$ cat test.f90
      module mytype_module
      type mytype
         private
         complex value
         logical exact
      end type
         interface mytype
            module procedure int_to_mytype
         end interface
         contains
          type(mytype) function int_to_mytype(i)
             integer, intent(in) :: i
             int_to_mytype%value = i
             int_to_mytype%exact = .TRUE.
          end function
      end module mytype_module

$ gfortran test.f90
In file t44.f90:7

interface mytype
1
Error: DERIVED attribute conflicts with PROCEDURE attribute at (1)
In file t44.f90:8


14.1.2 of the draft standard determines that both instances of mytype are local entitities to the same scoping unit. gfortran takes them to refer to the same symbol and so finds that the attributes clash.

To add to the list, ifort9.0 sings this song:
fortcom: Error: uttam.f90, line 2: Conflicting attributes or multiple declaration of name. [MYTYPE]
before going on to complain about things that look like bits of derived type that are not.


This definitely is not valid code.
Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]