re PR fortran/33188 (Fortran 2003: Type declarations without componends)
authorTobias Burnus <burnus@net-b.de>
Sun, 26 Aug 2007 17:59:34 +0000 (19:59 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Sun, 26 Aug 2007 17:59:34 +0000 (19:59 +0200)
2007-08-26  Tobias Burnus  <burnus@net-b.de>

PR fortran/33188
* parse.c (parse_derived): Support empty derived type
definitions for Fortran 2003.

2007-08-26  Tobias Burnus  <burnus@net-b.de>

PR fortran/33188
* gfortran.dg/used_types_18.f90: New.

From-SVN: r127808

gcc/fortran/ChangeLog
gcc/fortran/parse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/used_types_18.f90 [new file with mode: 0644]

index 590258a..9adaf07 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-26  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33188
+       * parse.c (parse_derived): Support empty derived type
+       definitions for Fortran 2003.
+
 2007-08-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * trans-openmp.c (gfc_omp_privatize_by_reference): Constify.
index 835b05a..df7f68f 100644 (file)
@@ -1544,11 +1544,11 @@ parse_derived (void)
        case ST_END_TYPE:
          compiling_type = 0;
 
-         if (!seen_component)
-           {
-             gfc_error ("Derived type definition at %C has no components");
-             error_flag = 1;
-           }
+         if (!seen_component
+             && (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Derived type "
+                                "definition at %C without components")
+                 == FAILURE))
+           error_flag = 1;
 
          accept_statement (ST_END_TYPE);
          break;
index 7547f4b..37d280e 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-26  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33188
+       * gfortran.dg/used_types_18.f90: New.
+
 2007-08-25  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/array-init-2.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/used_types_18.f90 b/gcc/testsuite/gfortran.dg/used_types_18.f90
new file mode 100644 (file)
index 0000000..e3dca1f
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg do-compile }
+! { dg-options "-std=f2003" }
+!
+! Fortran 2003 allowes TYPE without components
+! The error message for -std=f95 is tested in
+! gfortran.dg/access_spec_2.f90
+!
+! PR fortran/33188
+!
+type t
+end type
+end