1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Tests attempts at forward references to local names in a FUNCTION prefix
4 ! This case is not an error, but will elicit bogus errors if the
5 ! result type of the function is badly resolved.
12 type(t1
) function foo(n
)
13 integer, intent(in
) :: n
34 integer, parameter :: k
= kind(1.e0
)
36 real(kind
=k
) function foo(n
)
37 integer, parameter :: k
= kind(1.d0
)
38 integer, intent(in
) :: n
45 !If we got the type of foo right, this declaration will fail
46 !due to an attempted division by zero.
47 !WARNING: INTEGER(4) division by zero
48 !ERROR: Must be a constant value
49 integer, parameter :: test
= 1 / (kind(foo(1)) - kind(1.d0
))
53 real(kind
=kind(1.0e0
)) :: x
55 real(kind
=kind(x
)) function foo(x
)
56 real(kind
=kind(1.0d0)) x
57 !WARNING: INTEGER(4) division by zero
58 !ERROR: Must be a constant value
59 integer, parameter :: test
= 1 / (kind(foo
) - kind(1.d0
))
66 real(n
) function foo(x
)
67 !ERROR: 'foo' is not an object that can appear in an expression
68 integer, parameter :: n
= kind(foo
)
69 real(n
), intent(in
) :: x
70 !ERROR: 'x' is not an object that can appear in an expression