if (strcmp (e->symtree->n.sym->name, param->name) == 0)
break;
- if (param)
+ if (param && param->expr)
{
copy = gfc_copy_expr (param->expr);
*e = *copy;
/* Try simplification even for LEN expressions. */
bool ok;
gfc_resolve_expr (kind_expr);
+
+ if (c1->attr.pdt_kind
+ && kind_expr->expr_type != EXPR_CONSTANT
+ && type_param_spec_list)
+ gfc_insert_parameter_exprs (kind_expr, type_param_spec_list);
+
ok = gfc_simplify_expr (kind_expr, 1);
/* Variable expressions seem to default to BT_PROCEDURE.
TODO find out why this is and fix it. */
return MATCH_ERROR;
}
+ if (dt_sym && decl_type_param_list
+ && dt_sym->attr.flavor == FL_DERIVED
+ && !dt_sym->attr.pdt_type
+ && !dt_sym->attr.pdt_template)
+ {
+ gfc_error ("Type %qs is not parameterized and so the type parameter spec "
+ "list at %C may not appear", dt_sym->name);
+ return MATCH_ERROR;
+ }
+
if (sym && sym->attr.flavor == FL_DERIVED
&& sym->attr.pdt_template
&& gfc_current_state () != COMP_DERIVED)
NULL. */
if (gfc_peek_ascii_char() == '(')
type_spec_list = true;
-
+ if (!actual_arglist && !type_spec_list)
+ {
+ gfc_error_now ("F2023 R755: The empty type specification at %C "
+ "is not allowed");
+ m = MATCH_ERROR;
+ break;
+ }
/* Generate this instance using the type parameters from the
first argument list and return the parameter list in
ctr_arglist. */
--- /dev/null
+! { dg-do compile }
+!
+! Test the fix for pr95543. The variable declaration in each subroutine used to ICE
+! because the substitution of a in the default initializers of b was not being done.
+!
+! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+program p
+ call foo1
+ call foo2
+ call foo3
+ call foo4
+contains
+ subroutine foo1
+ type t(a, b)
+ integer, kind :: a = 4
+ integer, kind :: b = a + 4
+ end type
+ type(t()) :: z ! { dg-error "empty type specification" }
+ print *, z%b
+ end
+ subroutine foo2
+ type t(a, b)
+ integer, kind :: a = 1
+ integer, kind :: b = a
+ end type
+ type(t) :: z
+ print *, z%b
+ end
+ subroutine foo3
+ type t(a, b)
+ integer, kind :: a = 1
+ integer, kind :: b = a
+ end type
+ type(t(2)) :: z
+ print *, z%b
+ end
+ subroutine foo4
+ type t(a, b)
+ integer, kind :: a = 4
+ integer, kind :: b = a + 4
+ end type
+ type(t(b = 6)) :: z
+ print *, z%b
+ end
+end
+
--- /dev/null
+! { dg-do compile }
+!
+! Test fix for PR103748.
+!
+! Contributed by Bastiaan Braams <b.j.braams@cwi.nl>
+!
+program test
+ implicit none
+ type f_type
+ integer, allocatable :: x(:)
+ end type f_type
+ type (f_type(n=9)) :: f ! { dg-error "is not parameterized" }
+ stop
+end program test