fails to compile the valid code

Paul Thomas paulthomas2@wanadoo.fr
Wed Nov 23 04:41:00 GMT 2005


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



More information about the Fortran mailing list