! File: interface2.f90 ! Public domain 2004 James Van Buskirk ! Second stage in preliminary to attempt to create function ! with LEN given by specification expression via function ! name, and SIZE given by specification expression via ! result name. ! g95 12/18/04: Symbol test2 has no IMPLICIT type. ! ISO/IEC 1539-1:1997(E) section 12.5.2.2: ! "The type and type parameters (if any) of the result of the ! function defined by a function subprogram may be specified ! by a type specification in the FUNCTION statement or by the ! name of the result variable appearing in a type in the ! declaration part of the function subprogram. It shall not ! be specified both ways. If it is not specified either way, ! it is determined by the implicit typing rules in force within ! the function subprogram." ! So g95's error message is incorrect. ! CVF 6.6C3: Error: A CHARACTER function name must not be ! declared with an asterisk type-param-value ((i.e. LEN=*)) ! if the function is a module function. [TEST2] ! So CVF is dead in the water at this point. ! LF95 5.70f: No errors, no warnings, output: ! 21 ! ABCDEFGHIJKLMNOPQRSTU ! ISO/IEC 1539-1:1997(E) section 7.1.6.2: ! "If a variable in a specification expression is typed by the ! implicit typing rules, its appearance in any subsequent ! type declaration statement shall confirm the implied type and ! type parameters." ! Right on, LF95! module test1 implicit none contains function test2(x) implicit integer (x) implicit character(f(x)) (t) integer, intent(in) :: x interface pure function f(x) integer, intent(in) :: x integer f end function f end interface integer i do i = 1, len(test2) test2(i:i) = achar(mod(i,32)+iachar('@')) end do end function test2 end module test1 program test use test1 implicit none write(*,*) len(test2(10)) write(*,*) test2(10) end program test pure function f(x) integer, intent(in) :: x integer f f = 2*x+1 end function f