1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Confirm enforcement of constraints and restrictions in 15.6.2.1
4 non_recursive
function f01(n
) result(res
)
10 !ERROR: NON_RECURSIVE procedure 'f01' cannot call itself
11 res
= n
* f01(n
-1) ! 15.6.2.1(3)
15 non_recursive
function f02(n
) result(res
)
24 integer function nested
25 !ERROR: NON_RECURSIVE procedure 'f02' cannot call itself
26 nested
= n
* f02(n
-1) ! 15.6.2.1(3)
30 !ERROR: An assumed-length CHARACTER(*) function cannot be RECURSIVE
31 recursive character(*) function f03(n
) ! C723
36 !ERROR: An assumed-length CHARACTER(*) function cannot be RECURSIVE
37 recursive function f04(n
) result(res
) ! C723
43 !ERROR: An assumed-length CHARACTER(*) function cannot return an array
44 character(*) function f05()
45 dimension :: f05(1) ! C723
49 !ERROR: An assumed-length CHARACTER(*) function cannot return an array
51 character(*) :: f06(1) ! C723
55 !ERROR: An assumed-length CHARACTER(*) function cannot return a POINTER
56 character(*) function f07()
58 character, target
:: a
= ' '
62 !ERROR: An assumed-length CHARACTER(*) function cannot return a POINTER
64 character(*), pointer :: f08
! C723
65 character, target
:: a
= ' '
69 !ERROR: An assumed-length CHARACTER(*) function cannot be PURE
70 pure
character(*) function f09() ! C723
74 !ERROR: An assumed-length CHARACTER(*) function cannot be PURE
76 character(*) :: f10
! C723
80 !ERROR: An assumed-length CHARACTER(*) function cannot be ELEMENTAL
81 elemental
character(*) function f11(n
) ! C723
86 !ERROR: An assumed-length CHARACTER(*) function cannot be ELEMENTAL
87 elemental
function f12(n
)
88 character(*) :: f12
! C723
93 function f13(n
) result(res
)
99 !ERROR: Assumed-length CHARACTER(*) function 'f13' cannot call itself
100 !ERROR: Assumed-length character function must be defined with a length to be called
101 res
= f13(n
-1) ! 15.6.2.1(3)
105 function f14(n
) result(res
)
114 character(1) function nested
115 !ERROR: Assumed-length CHARACTER(*) function 'f14' cannot call itself
116 !ERROR: Assumed-length character function must be defined with a length to be called
117 nested
= f14(n
-1) ! 15.6.2.1(3)
121 subroutine s01(f1
, f2
, fp1
, fp2
)
122 !PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
123 character*(*) :: f1
, f3
, fp1
126 !PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
127 procedure(character*(*)), pointer :: fp2
129 character*(*) function f2()
131 !ERROR: A function interface may not declare an assumed-length CHARACTER(*) result
132 character*(*) function f4()
137 !ERROR: Assumed-length character function must be defined with a length to be called