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 !PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
12 procedure(sin
) :: dummy
14 subroutine badsubr(dummy
)
16 !ERROR: A dummy procedure may not be ELEMENTAL
17 procedure(elem
) :: dummy
19 subroutine optionalsubr(dummy
)
20 !PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
21 procedure(sin
), optional
:: dummy
23 subroutine ptrsubr(dummy
)
24 !PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
25 procedure(sin
), pointer, intent(in
) :: dummy
29 call subr(cos
) ! not an error
30 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
31 call subr(elem
) ! C1533
32 !ERROR: Actual argument associated with procedure dummy argument 'dummy=' is a null pointer
34 call optionalsubr(null()) ! ok
35 call ptrsubr(null()) ! ok
36 !ERROR: Actual argument associated with procedure dummy argument 'dummy=' is typeless
41 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
44 elemental
integer function elem()
56 !ERROR: Statement function 'sf' may not be passed as an actual argument
58 !ERROR: Statement function 'sf' may not be passed as an actual argument
63 procedure(sin
) :: elem01
65 elemental
real function elem02(x
)
73 elemental
real function elem03(x
)
78 call callme(cos
) ! not an error
79 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument
80 call callme(elem01
) ! C1533
81 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem02' may not be passed as an actual argument
82 call callme(elem02
) ! C1533
83 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem03' may not be passed as an actual argument
84 call callme(elem03
) ! C1533
85 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem04' may not be passed as an actual argument
86 call callme(elem04
) ! C1533
88 elemental
real function elem04(x
)
96 integer, pointer :: ptr
101 type(t
), intent(in
) :: x
104 !ERROR: Coindexed object 'coarray' with POINTER ultimate component '%ptr' cannot be associated with dummy argument 'x='
105 call callee(coarray
[1]) ! C1537
112 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
115 elemental
integer function elem()
124 l
= index
.eq
. 0 ! index is an object entity, not an intrinsic
126 !ERROR: Actual argument associated with procedure dummy argument 'p=' is not a procedure
139 !ERROR: No explicit type declared for 'index'
144 integer :: a1(2), a2
, a3
145 !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
146 !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
149 elemental
subroutine s1(a
, b
, c
)
150 integer, intent(in
) :: a
151 integer, intent(out
) :: b
152 integer, intent(inout
) :: c