[Bug fortran/48095] [OOP] Invalid assignment to procedure pointer component not rejected

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 27 09:01:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48095

--- Comment #2 from janus at gcc dot gnu.org 2011-03-26 21:07:42 UTC ---
The following variant is correctly being rejected:


  implicit none

  type :: rectangle
    real :: width, height
    procedure(get_area), pointer, pass(this) :: get_special_area
  end type rectangle

  abstract interface
    real function get_area( this )
      import                       :: rectangle
      class(rectangle), intent(in) :: this
    end function get_area
  end interface

   type(rectangle) :: rect

   rect%get_special_area => get_my_area

contains

  real function get_my_area( this )
    type(rectangle), intent(in) :: this
    write(*,*) 'This: ', this%width, this%height
    get_my_area = 3.0 * this%width * this%height
  end function get_my_area

end



   rect%get_special_area => get_my_area
                            1
Error: Interface mismatch in procedure pointer assignment at (1): Type/rank
mismatch in argument 'this'



More information about the Gcc-bugs mailing list