2 ! { dg-options "-std=legacy" }
3 ! Tests the patch for PRs 25084, 20852, 25085 and 25086, all of
4 ! which involve assumed character length functions.
5 ! Compiled from original PR testcases, which were all contributed
6 ! by Joost VandeVondele <jv244@cam.ac.uk>
8 ! PR25084 - the error is not here but in any use of .IN.
9 ! It is OK to define an assumed character length function
10 ! in an interface but it cannot be invoked (5.1.1.5).
19 INTERFACE OPERATOR (.IN
.)
20 FUNCTION ELEMENT(X
,A
) ! { dg-error "cannot be assumed character length" }
22 CHARACTER(LEN
=*) :: ELEMENT
23 INTEGER, INTENT(IN
) :: X
24 TYPE(SET
), INTENT(IN
) :: A
29 ! 5.1.1.5 of the Standard: A function name declared with an asterisk
30 ! char-len-param shall not be array-valued, pointer-valued, recursive
34 RECURSIVE FUNCTION TEST() ! { dg-error "cannot be recursive" }
35 CHARACTER(LEN
=*) :: TEST
40 FUNCTION F1() ! { dg-error "cannot be array-valued" }
41 CHARACTER(LEN
=*), DIMENSION(10) :: F1
46 FUNCTION F2() result(f4
) ! { dg-error "cannot be pointer-valued" }
47 CHARACTER(LEN
=*), POINTER :: f4
52 pure
FUNCTION F3() ! { dg-error "cannot be pure" }
53 CHARACTER(LEN
=*) :: F3
58 character(*) not_OK
, ch
! OK in an external function
64 character(4) :: answer
65 character(*), external :: not_OK
76 answer
= not_OK ("unOK") ! { dg-error "since it is not a dummy" }