1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Testing 15.6.2.2 point 4 (What function-name refers to depending on the
7 ! Without RESULT, it refers to the result object (no recursive
10 ! testing with data object results
13 !ERROR: Recursive call to 'f1' requires a distinct RESULT in its declaration
21 !ERROR: Recursive call to 'f2' requires a distinct RESULT in its declaration
29 ! OK reference to array result f1
35 ! testing with function pointer results
40 procedure(rf
), pointer :: f4
42 ! OK call to f4 pointer (rf)
44 !ERROR: Actual argument for 'x=' may not be a procedure
50 real function rfunc(x
)
54 procedure(rfunc
), pointer :: f5
56 ! OK call to f5 pointer
58 !ERROR: Actual argument for 'x=' may not be a procedure
61 ! Sanity test: f18 handles C1560 violation by ignoring RESULT
62 function f6() result(f6
) !OKI (warning)
64 function f7() result(f7
) !OKI (warning)
66 !ERROR: Recursive call to 'f7' requires a distinct RESULT in its declaration
74 ! With RESULT, it refers to the function (recursive calls possible)
77 ! testing with data object results
78 function f1() result(r
)
80 r
= acos(f1()) !OK, recursive call
81 !ERROR: Actual argument for 'x=' may not be a procedure
84 function f2(i
) result(r
)
87 r
= acos(f2(i
+1)) ! OK, recursive call
88 !ERROR: Actual argument for 'x=' may not be a procedure
91 function f3(i
) result(r
)
94 r
= acos(f3(i
+1)) !OK recursive call
95 !ERROR: Actual argument for 'x=' may not be a procedure
99 ! testing with function pointer results
103 function f4() result(r
)
105 procedure(rf
), pointer :: r
107 !ERROR: Actual argument for 'x=' may not be a procedure
108 x
= acos(f4()) ! recursive call
109 !ERROR: Actual argument for 'x=' may not be a procedure
113 function f5(x
) result(r
)
115 procedure(acos
), pointer :: r
117 !ERROR: Actual argument for 'x=' may not be a procedure
118 x
= acos(f5(x
+1)) ! recursive call
119 !ERROR: Actual argument for 'x=' may not be a procedure
121 x
= acos(r(x
+1)) ! OK
124 ! testing that calling the result is also caught
125 function f6() result(r
)
127 !ERROR: 'r' is not a callable procedure
132 subroutine array_rank_test()
134 !ERROR: Reference to rank-2 object 'x' has 1 subscripts
136 !ERROR: Reference to rank-2 object 'x' has 3 subscripts