This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/49638] [OOP] length parameter is ignored when overriding type bound character functions with constant length.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]