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/48095] [OOP] Invalid assignment to procedure pointer component not rejected


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'


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