2011-02-15 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / used_before_typed_3.f90
blobab1b2a91f0ae05a751458d6c4c5265c07410c4b9
1 ! { dg-do compile }
2 ! { dg-options "-std=f95" }
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.
9 MODULE testmod
10 IMPLICIT REAL(a-z)
12 CONTAINS
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
20 CHARACTER(len=x) FUNCTION test2 (x) ! { dg-bogus "used before|of INTEGER" }
21 IMPLICIT INTEGER(a-z)
22 test2 = "foobar"
23 END FUNCTION test2
25 END MODULE testmod
27 CHARACTER(len=i) FUNCTION test3 (i) ! { dg-bogus "used before|of INTEGER" }
28 ! i is IMPLICIT INTEGER by default
29 test3 = "foobar"
30 END FUNCTION test3
32 CHARACTER(len=g) FUNCTION test4 (g) ! { dg-error "of INTEGER" }
33 ! g is REAL, unless declared INTEGER.
34 test4 = "foobar"
35 END FUNCTION test4
37 ! Test an empty function works, too.
38 INTEGER FUNCTION test5 ()
39 END FUNCTION test5
41 ! { dg-final { cleanup-modules "testmod" } }