gcc/fortran/ChangeLog:
PR fortran/104351
* decl.cc (get_proc_name): Extend name conflict detection between
internal procedure and previous declaration also to derived type.
gcc/testsuite/ChangeLog:
PR fortran/104351
* gfortran.dg/derived_function_interface_1.f90: Adjust pattern.
* gfortran.dg/pr104351.f90: New test.
/* Trap declarations of attributes in encompassing scope. The
signature for this is that ts.kind is nonzero for no-CLASS
entity. For a CLASS entity, ts.kind is zero. */
- if ((sym->ts.kind != 0 || sym->ts.type == BT_CLASS)
+ if ((sym->ts.kind != 0
+ || sym->ts.type == BT_CLASS
+ || sym->ts.type == BT_DERIVED)
&& !sym->attr.implicit_type
&& sym->attr.proc == 0
&& gfc_current_ns->parent != NULL
contains
- type(foo) function fun() ! { dg-error "already has an explicit interface" }
+ type(foo) function fun() ! { dg-error "has an explicit interface" }
end function fun ! { dg-error "Expecting END PROGRAM" }
end
--- /dev/null
+! { dg-do compile }
+! PR fortran/104351
+! Contributed by G.Steinmetz
+
+program p
+ implicit none
+ type t
+ end type
+ type(t) :: f
+contains
+ real function f() result(z) ! { dg-error "has an explicit interface" }
+ z = 0.0 ! { dg-error "assignment" }
+ end function f ! { dg-error "Expecting END PROGRAM" }
+end