the implicit_flag is not needed, so it was removed. Derived types are
identified by their name alone. */
-match
-gfc_match_type_spec (gfc_typespec *ts)
+static match
+match_type_spec (gfc_typespec *ts)
{
match m;
locus old_locus;
}
+match
+gfc_match_type_spec (gfc_typespec *ts)
+{
+ match m;
+ gfc_namespace *old_ns = gfc_current_ns;
+ m = match_type_spec (ts);
+ gfc_current_ns = old_ns;
+ return m;
+}
+
+
/******************** FORALL subroutines ********************/
/* Free a list of FORALL iterators. */
return MATCH_YES;
syntax:
- gfc_error ("Syntax error in TYPE IS specification at %C");
+
+ if (!gfc_error_check ())
+ gfc_error ("Syntax error in TYPE IS specification at %C");
cleanup:
if (c != NULL)
--- /dev/null
+! { dg-do compile }
+!
+! Test the fix for PR107142, which used to ICE after a syntax error.
+!
+! Contributed by Arseny Solokha <asolokha@gmx.com>
+!
+module c1162a
+ type pdt(kind,len)
+ integer, kind :: kind
+ integer, len :: len
+ end type
+ contains
+ subroutine foo(x)
+ class(pdt(kind = 1, len = :)), allocatable :: x
+ select type (x)
+ type is (pdt(kind = *, len = *)) ! { dg-error "does not have a default value" }
+ type is (pdt(kind = :, len = *)) ! { dg-error "does not have a default value" }
+ end select
+ select type (x)
+ type is (pdt(kind = 1, len = *)) ! This, of course, is OK
+ end select
+ end subroutine
+end module