Only check for kind if the type supports kind.
2020-10-12 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/fortran/ChangeLog:
PR fortran/96099
* decl.c (gfc_match_implicit): Check for numeric and logical
types.
2020-10-12 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/ChangeLog:
PR fortran/96099
* gfortran.dg/pr96099_1.f90: New test.
* gfortran.dg/pr96099_2.f90: New test.
/* Last chance -- check <TYPE> <SELECTOR> (<RANGE>). */
if (ts.type == BT_CHARACTER)
m = gfc_match_char_spec (&ts);
- else if (ts.type != BT_DERIVED)
+ else if (gfc_numeric_ts(&ts) || ts.type == BT_LOGICAL)
{
m = gfc_match_kind_spec (&ts, false);
if (m == MATCH_NO)
--- /dev/null
+! { dg-do compile }
+
+program pr96099_1
+ implicit class(t) (1) ! { dg-error "Syntax error in IMPLICIT" }
+ type t
+ end type
+end
+
--- /dev/null
+! { dg-do compile }
+
+program pr96099_2
+ integer n1
+ parameter (n1 = 1)
+ implicit class(t) (n1) ! { dg-error "Syntax error in IMPLICIT" }
+ type t
+ end type
+end