1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
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
)
79 call callme(cos
) ! not an error
80 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument
81 call callme(elem01
) ! C1533
82 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem02' may not be passed as an actual argument
83 call callme(elem02
) ! C1533
84 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem03' may not be passed as an actual argument
85 call callme(elem03
) ! C1533
86 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem04' may not be passed as an actual argument
87 call callme(elem04
) ! C1533
89 elemental
real function elem04(x
)
98 integer, pointer :: ptr
100 type(t
) :: coarray
[*]
103 type(t
), intent(in
) :: x
106 !ERROR: Coindexed object 'coarray' with POINTER ultimate component '%ptr' cannot be associated with dummy argument 'x='
107 call callee(coarray
[1]) ! C1537
114 !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument
117 elemental
integer function elem()
126 l
= index
.eq
. 0 ! index is an object entity, not an intrinsic
128 !ERROR: Actual argument associated with procedure dummy argument 'p=' is not a procedure
141 !ERROR: No explicit type declared for 'index'
146 integer :: a1(2), a2
, a3
147 !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
148 !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
151 elemental
subroutine s1(a
, b
, c
)
152 integer, intent(in
) :: a
153 integer, intent(out
) :: b
154 integer, intent(inout
) :: c