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
This commit is contained in:
parent
d8d9b83b33
commit
99d2293dbf
4 changed files with 49 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
32
gcc/testsuite/gfortran.dg/deferred_character_20.f90
Normal file
32
gcc/testsuite/gfortran.dg/deferred_character_20.f90
Normal file
|
@ -0,0 +1,32 @@
|
|||
! { 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
|
Loading…
Add table
Reference in a new issue