1! { dg-do compile } 2! { dg-options "-std=f95" } 3 4! PR fortran/32095 5! PR fortran/34228 6! Check for a special case when the return-type of a function is given outside 7! its "body" and contains symbols defined inside. 8 9MODULE testmod 10 IMPLICIT REAL(a-z) 11 12CONTAINS 13 14 CHARACTER(len=x) FUNCTION test1 (x) ! { dg-error "of INTEGER" } 15 IMPLICIT REAL(a-z) 16 INTEGER :: x ! { dg-error "already has basic type" } 17 test1 = "foobar" 18 END FUNCTION test1 19 20 CHARACTER(len=x) FUNCTION test2 (x) ! { dg-error "of INTEGER" } 21 IMPLICIT INTEGER(a-z) 22 test2 = "foobar" 23 END FUNCTION test2 24 25END MODULE testmod 26 27CHARACTER(len=i) FUNCTION test3 (i) 28 ! i is IMPLICIT INTEGER by default 29 test3 = "foobar" 30END FUNCTION test3 31 32CHARACTER(len=g) FUNCTION test4 (g) ! { dg-error "of INTEGER" } 33 ! g is REAL, unless declared INTEGER. 34 test4 = "foobar" 35END FUNCTION test4 36 37! Test an empty function works, too. 38INTEGER FUNCTION test5 () 39END FUNCTION test5 40