[Patch, Fortran, OOP] PR 49638: [OOP] length parameter is ignored when overriding type bound character functions with constant length.
Janus Weil
janus@gcc.gnu.org
Sat Aug 6 17:10:00 GMT 2011
> Here is a variant of the original test case from the PR, which will be
> accepted if we only check for names (but it should actually be
> rejected):
>
>
> module world
>
> implicit none
>
> type :: world_1
> contains
> procedure, nopass :: string => w1_string
> end type
>
> type, extends(world_1) :: world_2
> contains
> procedure, nopass :: string => w2_string
> end type
>
> contains
>
> function w1_string (m)
> integer, parameter :: n = 5
> integer, intent(in) :: m
> character(n+m) :: w1_string
> w1_string = "world"
> end function
>
> function w2_string (m)
> integer, parameter :: n = 6
> integer, intent(in) :: m
> character(n+m) :: w2_string
> w2_string = "world2"
> end function
>
> end module
Sorry, now I have to disagree with my own earlier claims: In this
example, the 'n' variables will of course be simplified to
EXPR_CONSTANTs, so the name checking does not apply to them.
And since the string length can not depend on local variables which
are *not* constant, name checking should still be fine!
Now, if Thomas says it's fine for the other cases, too, then it seems
we can really get away with a much simpler patch. Hope we're not
missing anything, though ...
Cheers,
Janus
More information about the Fortran
mailing list