This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49638] [OOP] length parameter is ignored when overriding type bound character functions with constant length.
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 3 Aug 2011 18:53:19 +0000
- Subject: [Bug fortran/49638] [OOP] length parameter is ignored when overriding type bound character functions with constant length.
- Auto-submitted: auto-generated
- References: <bug-49638-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49638
--- Comment #5 from janus at gcc dot gnu.org 2011-08-03 18:53:17 UTC ---
I think in general we may also have to reject differing non-constant string
lengths (at least that's what ifort does), as in:
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(x)
integer, intent(in) :: x
character(2*x) :: w1_string
w1_string = "world"
end function
function w2_string(x)
integer, intent(in) :: x
character(3*x) :: w2_string
w2_string = "world2"
end function
end module
program hello
use world
implicit none
type(world_1)::w1
type(world_2)::w2
print *,"hello world: hello ",w1%string(3),"!"
print *,"hello world2: hello ",w2%string(3),"!"
end program