1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! 15.5.1 procedure reference constraints and restrictions
4 subroutine s01(elem
, subr
)
6 !ERROR: A dummy procedure may not be ELEMENTAL
7 elemental
real function elem(x
)
8 real, intent(in
), value
:: x
10 subroutine subr(dummy
)
11 procedure(sin
) :: dummy
13 subroutine badsubr(dummy
)
15 !ERROR: A dummy procedure may not be ELEMENTAL
16 procedure(elem
) :: dummy
18 subroutine optionalsubr(dummy
)
19 procedure(sin
), optional
:: dummy
21 subroutine ptrsubr(dummy
)
22 procedure(sin
), pointer, intent(in
) :: dummy
26 call subr(cos
) ! not an error
27 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
28 call subr(elem
) ! C1533
29 !ERROR: Actual argument associated with procedure dummy argument 'dummy=' is a null pointer
31 call optionalsubr(null()) ! ok
32 call ptrsubr(null()) ! ok
33 !ERROR: Actual argument associated with procedure dummy argument 'dummy=' is typeless
38 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
41 elemental
integer function elem()
53 !ERROR: Statement function 'sf' may not be passed as an actual argument
55 !ERROR: Statement function 'sf' may not be passed as an actual argument
60 procedure(sin
) :: elem01
62 elemental
real function elem02(x
)
70 elemental
real function elem03(x
)
75 call callme(cos
) ! not an error
76 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument
77 call callme(elem01
) ! C1533
78 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem02' may not be passed as an actual argument
79 call callme(elem02
) ! C1533
80 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem03' may not be passed as an actual argument
81 call callme(elem03
) ! C1533
82 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem04' may not be passed as an actual argument
83 call callme(elem04
) ! C1533
85 elemental
real function elem04(x
)
93 integer, pointer :: ptr
98 type(t
), intent(in
) :: x
101 !ERROR: Coindexed object 'coarray' with POINTER ultimate component '%ptr' cannot be associated with dummy argument 'x='
102 call callee(coarray
[1]) ! C1537
109 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
112 elemental
integer function elem()
121 l
= index
.eq
. 0 ! index is an object entity, not an intrinsic
123 !ERROR: Actual argument associated with procedure dummy argument 'p=' is not a procedure
136 !ERROR: No explicit type declared for 'index'
141 integer :: a1(2), a2
, a3
142 !ERROR: In an elemental procedure reference with at least one array argument, actual argument a2 that corresponds to an INTENT(OUT) or INTENT(INOUT) dummy argument must be an array
143 !ERROR: In an elemental procedure reference with at least one array argument, actual argument a3 that corresponds to an INTENT(OUT) or INTENT(INOUT) dummy argument must be an array
146 elemental
subroutine s1(a
, b
, c
)
147 integer, intent(in
) :: a
148 integer, intent(out
) :: b
149 integer, intent(inout
) :: c