OSDN Git Service

2011-10-11 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / interface_24.f90
1 ! { dg-do compile }
2 !
3 ! This tests the fix for PR36361: If a function was declared in an INTERFACE
4 ! statement, no attributes may be declared outside of the INTERFACE body.
5 !
6 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7
8 module m1
9   interface
10     real function f1()
11     end function
12   end interface
13   dimension :: f1(4)  ! { dg-error "outside its INTERFACE body" }
14 end module
15
16
17 module m2
18   dimension :: f2(4)
19   interface
20     real function f2()  ! { dg-error "outside its INTERFACE body" }
21     !end function
22   end interface
23 end module
24
25
26 ! valid
27 module m3
28   interface
29     real function f3()
30       dimension :: f3(4)
31     end function
32   end interface
33 end module
34
35
36 module m4
37   interface
38     function f4()  ! { dg-error "cannot have a deferred shape" }
39       real :: f4(:)
40     end function
41   end interface
42   allocatable :: f4  ! { dg-error "outside of INTERFACE body" }
43 end module
44
45
46 module m5
47   allocatable :: f5(:)
48   interface
49     function f5()  ! { dg-error "outside its INTERFACE body" }
50       !real f5(:)
51     !end function
52   end interface
53 end module
54
55
56 !valid
57 module m6
58   interface
59     function f6()
60       real f6(:)
61       allocatable :: f6
62     end function
63   end interface
64 end module
65
66 ! { dg-final { cleanup-modules "m1 m2 m3 m4 m5 m6" } }