Commit 99d2293d by Paul Thomas

re PR fortran/86408 (bogus error: ABSTRACT INTERFACE must not have an assumed…

re PR fortran/86408 (bogus error: ABSTRACT INTERFACE must not have an assumed character length result (F2003: C418))

2018-07-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/86408
	* resolve.c.c (resolve_contained_fntype): Reference to C418 is
	in F2008 and not F2003.
	(resolve_function): Ditto in error message. Also, exclude
	deferred character length results from the error.

2018-07-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/86408
	* gfortran.dg/deferred_character_20.f90: New test.

From-SVN: r262445
parent d8d9b83b
2018-07-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/86408
* resolve.c.c (resolve_contained_fntype): Reference to C418 is
in F2008 and not F2003.
(resolve_function): Ditto in error message. Also, exclude
deferred character length results from the error.
2018-07-05 Fritz Reese <fritzoreese@gmail.com>
PR fortran/83183
......
......@@ -601,7 +601,7 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns)
}
}
/* Fortran 2003 Draft Standard, page 535, C418, on type-param-value
/* Fortran 2008 Draft Standard, page 535, C418, on type-param-value
type, lists the only ways a character length value of * can be used:
dummy arguments of procedures, named constants, function results and
in allocate statements if the allocate_object is an assumed length dummy
......@@ -3117,10 +3117,11 @@ resolve_function (gfc_expr *expr)
cannot be an assumed length character (F2003: C418). */
if (sym && sym->attr.abstract && sym->attr.function
&& sym->result->ts.u.cl
&& sym->result->ts.u.cl->length == NULL)
&& sym->result->ts.u.cl->length == NULL
&& !sym->result->ts.deferred)
{
gfc_error ("ABSTRACT INTERFACE %qs at %L must not have an assumed "
"character length result (F2003: C418)", sym->name,
"character length result (F2008: C418)", sym->name,
&sym->declared_at);
return false;
}
......
2018-07-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/86408
* gfortran.dg/deferred_character_20.f90: New test.
2018-07-05 Fritz Reese <fritzoreese@gmail.com>
PR fortran/83183
......
! { dg-do compile }
!
! Test the fix for PR86408.
!
! Contributed by Janus Weil <janus@gcc.gnu.org>
!
module m
implicit none
type, abstract :: t
contains
procedure(ifc), deferred :: tbf
procedure :: tbs
end type
abstract interface
function ifc(x) result(str)
import :: t
class(t) :: x
character(len=:), allocatable :: str
end function
end interface
contains
subroutine tbs(x)
class(t) :: x
print *, x%tbf()
end subroutine
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment