OSDN Git Service

2010-04-24 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / used_before_typed_3.f90
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
9 MODULE testmod
10   IMPLICIT REAL(a-z)
11
12 CONTAINS
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-bogus "used before|of INTEGER" }
21     IMPLICIT INTEGER(a-z)
22     test2 = "foobar"
23   END FUNCTION test2
24
25 END MODULE testmod
26   
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
31
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
36
37 ! Test an empty function works, too.
38 INTEGER FUNCTION test5 ()
39 END FUNCTION test5
40
41 ! { dg-final { cleanup-modules "testmod" } }