fails to compile the valid code
Steve Kargl
sgk@troutmask.apl.washington.edu
Wed Nov 23 01:00:00 GMT 2005
On Tue, Nov 22, 2005 at 04:52:11PM -0800, Uttam Pawar wrote:
>
> $ 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
>
> module procedure int_to_mytype
> 1
> Error: MODULE PROCEDURE at (1) must be in a generic module interface
> In file t44.f90:9
>
> end interface
> 1
> Error: Expecting END MODULE statement at (1)
>
> This code compiles fine with xlf95.
>
Lahey claims the code is illegal.
Compiling program unit mytype_module at line 1:
1730-S: "SOURCE.F90", line 7, column 21: 'mytype' already used as a
type name.
1260-S: "SOURCE.F90", line 8, column 14: If the interface block has
no generic specification, a MODULE PROCEDURE statement must
not be specified.
Encountered 2 errors, 0 warnings, 0 informations in file SOURCE.F90.
Compiling file SOURCE.F90.`
I suspect that xlf95 has a flag similar to -std=f95.
--
Steve
More information about the Fortran
mailing list