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