]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fortran/resolve.c
2019-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
[thirdparty/gcc.git] / gcc / fortran / resolve.c
index 8232deb81704b8cea92e1a6064870b7cbc801046..c565325ee2f4db129fd9d8d72548e82d6360b767 100644 (file)
@@ -1862,6 +1862,25 @@ resolve_procedure_expression (gfc_expr* expr)
 }
 
 
+/* Check that name is not a derived type.  */
+static bool
+is_dt_name (const char *name)
+{
+  gfc_symbol *dt_list, *dt_first;
+
+  dt_list = dt_first = gfc_derived_types;
+  for (; dt_list; dt_list = dt_list->dt_next)
+    {
+      if (strcmp(dt_list->name, name) == 0)
+       return true;
+      if (dt_first == dt_list->dt_next)
+       break;
+    }
+  return false;
+}
+
+
 /* Resolve an actual argument list.  Most of the time, this is just
    resolving the expressions in the list.
    The exception is that we sometimes have to decide whether arguments
@@ -1923,6 +1942,13 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype,
 
       sym = e->symtree->n.sym;
 
+      if (sym->attr.flavor == FL_PROCEDURE && is_dt_name (sym->name))
+       {
+         gfc_error ("Derived type %qs is used as an actual "
+                    "argument at %L", sym->name, &e->where);
+         goto cleanup;
+       }
+
       if (sym->attr.flavor == FL_PROCEDURE
          || sym->attr.intrinsic
          || sym->attr.external)