1! RUN: %S/test_errors.sh %s %t %flang_fc1 2! REQUIRES: shell 3! Test specification expressions 4 5module m 6 type :: t(n) 7 integer, len :: n = 1 8 character(len=n) :: c 9 end type 10 interface 11 integer function foo() 12 end function 13 pure real function realfunc(x) 14 real, intent(in) :: x 15 end function 16 pure integer function hasProcArg(p) 17 import realfunc 18 procedure(realfunc) :: p 19 end function 20 end interface 21 integer :: coarray[*] 22 contains 23 pure integer function modulefunc1(n) 24 integer, value :: n 25 modulefunc1 = n 26 end function 27 subroutine test(out, optional) 28 !ERROR: Invalid specification expression: reference to impure function 'foo' 29 type(t(foo())) :: x1 30 integer :: local 31 !ERROR: Invalid specification expression: reference to local entity 'local' 32 type(t(local)) :: x2 33 !ERROR: The internal function 'internal' may not be referenced in a specification expression 34 type(t(internal(0))) :: x3 35 integer, intent(out) :: out 36 !ERROR: Invalid specification expression: reference to INTENT(OUT) dummy argument 'out' 37 type(t(out)) :: x4 38 integer, intent(in), optional :: optional 39 !ERROR: Invalid specification expression: reference to OPTIONAL dummy argument 'optional' 40 type(t(optional)) :: x5 41 !ERROR: Invalid specification expression: dummy procedure argument 42 type(t(hasProcArg(realfunc))) :: x6 43 !ERROR: Invalid specification expression: coindexed reference 44 type(t(coarray[1])) :: x7 45 type(t(kind(foo()))) :: x101 ! ok 46 type(t(modulefunc1(0))) :: x102 ! ok 47 type(t(modulefunc2(0))) :: x103 ! ok 48 contains 49 pure integer function internal(n) 50 integer, value :: n 51 internal = n 52 end function 53 end subroutine 54 pure integer function modulefunc2(n) 55 integer, value :: n 56 modulefunc2 = n 57 end function 58end module 59