OSDN Git Service

2011-09-26 Janus Weil <janus@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / func_decl_4.f90
1 ! { dg-do compile }
2 ! { dg-options "-c" }
3 !
4 ! Functions shall not have an initializer.
5 !
6 ! Due to -fwhole-file, the function declaration
7 ! warnings come before the init warnings; thus
8 ! the warning for the WRONG lines have been moved to
9 ! func_decl_5.f90
10 !
11
12 function f1()
13   integer :: f1 = 42 ! WRONG, see  func_decl_5.f90
14 end function
15
16 function f2() RESULT (r)
17   integer :: r = 42 ! WRONG, see func_decl_5.f90
18 end function
19
20 function f3() RESULT (f3)          ! { dg-error "must be different than function name" }
21   integer :: f3 = 42
22 end function                       ! { dg-error "Expecting END PROGRAM" }
23 ! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 }