summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/func_decl_4.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/func_decl_4.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/func_decl_4.f9023
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/func_decl_4.f90 b/gcc/testsuite/gfortran.dg/func_decl_4.f90
new file mode 100644
index 000000000..edc6c7e25
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/func_decl_4.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-c" }
+!
+! Functions shall not have an initializer.
+!
+! Due to -fwhole-file, the function declaration
+! warnings come before the init warnings; thus
+! the warning for the WRONG lines have been moved to
+! func_decl_5.f90
+!
+
+function f1()
+ integer :: f1 = 42 ! WRONG, see func_decl_5.f90
+end function
+
+function f2() RESULT (r)
+ integer :: r = 42 ! WRONG, see func_decl_5.f90
+end function
+
+function f3() RESULT (f3) ! { dg-error "must be different than function name" }
+ integer :: f3 = 42
+end function ! { dg-error "Expecting END PROGRAM" }
+! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 }