• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! RUN: %S/test_errors.sh %s %t %f18
2! Tests valid and invalid usage of forward references to procedures
3! in specification expressions.
4module m
5  interface ifn2
6    module procedure if2
7  end interface
8  interface ifn3
9    module procedure if3
10  end interface
11  !ERROR: Automatic data object 'a' may not appear in the specification part of a module
12  real :: a(if1(1))
13  !ERROR: No specific procedure of generic 'ifn2' matches the actual arguments
14  real :: b(ifn2(1))
15 contains
16  subroutine t1(n)
17    integer :: iarr(if1(n))
18  end subroutine
19  pure integer function if1(n)
20    integer, intent(in) :: n
21    if1 = n
22  end function
23  subroutine t2(n)
24    integer :: iarr(ifn3(n)) ! should resolve to if3
25  end subroutine
26  pure integer function if2(n)
27    integer, intent(in) :: n
28    if2 = n
29  end function
30  pure integer function if3(n)
31    integer, intent(in) :: n
32    if3 = n
33  end function
34end module
35
36subroutine nester
37  !ERROR: The internal function 'if1' may not be referenced in a specification expression
38  real :: a(if1(1))
39 contains
40  subroutine t1(n)
41    !ERROR: The internal function 'if2' may not be referenced in a specification expression
42    integer :: iarr(if2(n))
43  end subroutine
44  pure integer function if1(n)
45    integer, intent(in) :: n
46    if1 = n
47  end function
48  pure integer function if2(n)
49    integer, intent(in) :: n
50    if2 = n
51  end function
52end subroutine
53