! File: interface3.f90 ! Public domain 2004 James Van Buskirk ! First attempt to actually 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 r has no IMPLICIT type. ! ISO/IEC 1539-1:1997(E) section 5.3: ! "An explicit type specification in a FUNCTION statement ! overrides an IMPLICIT statement for the name of the result ! variable of that function subprogram." ! This is the closest I can find to a statement to the effect ! that if neither the function name nor the result variable ! is explicitly typed, the result variable must be implicitly ! typed. I can still read the above passage as not being a ! definitive answer to this question. ! Still, I will pass g95 here and consider the standard ! document to be a little lacking regarding this question. ! CVF 6.6C3: Error: This name does not have a type, and must ! have an explicit type. [R] ! Again, pass CVF, incomplete the standard document. ! LF95 5.70f: Type parameters or bounds of variable r may ! not be inquired. ! Pass LF95. module test1 implicit none contains function test2(x) result(r) implicit integer (x) implicit character(f(x)) (t) dimension r(modulo(len(r)-1,3)+1) 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(r) r(:)(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