59 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Test specification expressions3 4module m5 type :: t(n)6 integer, len :: n = 17 character(len=n) :: c8 end type9 interface10 integer function foo()11 end function12 pure real function realfunc(x)13 real, intent(in) :: x14 end function15 pure integer function hasProcArg(p)16 import realfunc17 procedure(realfunc) :: p18 optional :: p19 end function20 end interface21 integer :: coarray[*]22 contains23 pure integer function modulefunc1(n)24 integer, value :: n25 modulefunc1 = n26 end function27 subroutine test(out, optional)28 !ERROR: Invalid specification expression: reference to impure function 'foo'29 type(t(foo())) :: x130 integer :: local31 !ERROR: Invalid specification expression: reference to local entity 'local'32 type(t(local)) :: x233 !ERROR: The internal function 'internal' may not be referenced in a specification expression34 type(t(internal(0))) :: x335 integer, intent(out) :: out36 !ERROR: Invalid specification expression: reference to INTENT(OUT) dummy argument 'out'37 type(t(out)) :: x438 integer, intent(in), optional :: optional39 !ERROR: Invalid specification expression: reference to OPTIONAL dummy argument 'optional'40 type(t(optional)) :: x541 !ERROR: Invalid specification expression: reference to function 'hasprocarg' with dummy procedure argument 'p'42 type(t(hasProcArg())) :: x643 !ERROR: Invalid specification expression: coindexed reference44 type(t(coarray[1])) :: x745 type(t(kind(foo()))) :: x101 ! ok46 type(t(modulefunc1(0))) :: x102 ! ok47 type(t(modulefunc2(0))) :: x103 ! ok48 contains49 pure integer function internal(n)50 integer, value :: n51 internal = n52 end function53 end subroutine54 pure integer function modulefunc2(n)55 integer, value :: n56 modulefunc2 = n57 end function58end module59