1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
! Test circular dependencies when declaring interface and using it in the function constructing that same interface
module functions_36_mod
real :: var
interface generic !>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Depends on both `f1` and `f2` to be declared
procedure :: f1
procedure :: f2
end interface
contains
pure function f1(vv) result(length)
real, intent(in) :: vv
integer :: rr(generic(vv, 2)) !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Depends on `f2` (but through interface) to be fully declared
integer :: length
length = size(rr)
end function
pure function f2(rr, int) result(length)
real, intent(in) :: rr
integer, intent(in) :: int
integer :: length
length = int*2
end function
subroutine maybe()
character(10) :: string(generic(var))
print *, size(string)
if (size(string) /= 4) error stop
end subroutine maybe
end module
program functions_36
use functions_36_mod
var =1.5
call maybe()
end program
|