Committed as 'obvious' in revision 256995.

Closing PR.

Paul

2018-23-01  Paul Thomas  <pa...@gcc.gnu.org>

    PR fortran/83866
    * decl.c (gfc_match_derived_decl): If eos not matched, recover
    and emit error about garbage after declaration.

2018-23-01  Paul Thomas  <pa...@gcc.gnu.org>

    PR fortran/83866
    * gfortran.dg/pdt_29.f03 : New test.
Index: gcc/fortran/decl.c
===================================================================
*** gcc/fortran/decl.c  (revision 256606)
--- gcc/fortran/decl.c  (working copy)
*************** gfc_match_derived_decl (void)
*** 9856,9862 ****
        gfc_error_recovery ();
        m = gfc_match_eos ();
        if (m != MATCH_YES)
!       return m;
        sym->attr.pdt_template = 1;
      }
  
--- 9856,9865 ----
        gfc_error_recovery ();
        m = gfc_match_eos ();
        if (m != MATCH_YES)
!       {
!         gfc_error_recovery ();
!         gfc_error_now ("Garbage after PARAMETERIZED TYPE declaration at %C");
!       }
        sym->attr.pdt_template = 1;
      }
  
Index: gcc/testsuite/gfortran.dg/pdt_29.f03
===================================================================
*** gcc/testsuite/gfortran.dg/pdt_29.f03        (nonexistent)
--- gcc/testsuite/gfortran.dg/pdt_29.f03        (working copy)
***************
*** 0 ****
--- 1,15 ----
+ ! { dg-do compile }
+ !
+ ! Test the fix for PR83866.f90
+ !
+ ! Contributed by G Steinmetz  <gs...@t-online.de>
+ !
+ program p
+   type private
+   end type
+    type t
+       class(t), pointer :: a
+    end type
+    type extends(t) :: t2 ! { dg-error "Garbage after | does not have a 
component" }
+    end type
+ end

Reply via email to