3 ! PR 48095: [OOP] Invalid assignment to procedure pointer component not rejected
5 ! Original test case by Arjen Markus <arjen.markus895@gmail.com>
6 ! Modified by Janus Weil <janus@gcc.gnu.org>
14 procedure(get_area_ai), pointer :: get_area => get_my_area ! { dg-error "Type/rank mismatch" }
18 real function get_area_ai( this )
20 class(rectangle), intent(in) :: this
21 end function get_area_ai
26 real function get_my_area( this )
27 type(rectangle), intent(in) :: this
28 get_my_area = 3.0 * this%width * this%height
29 end function get_my_area
33 !-------------------------------------------------------------------------------
41 procedure(get_area_ai), pointer :: get_area
45 real function get_area_ai (this)
47 class(rectangle), intent(in) :: this
48 end function get_area_ai
51 type(rectangle) :: rect
53 rect = rectangle (1.0, 2.0, get1)
54 rect = rectangle (3.0, 4.0, get2) ! { dg-error "Type/rank mismatch" }
58 real function get1 (this)
59 class(rectangle), intent(in) :: this
60 get1 = 1.0 * this%width * this%height
63 real function get2 (this)
64 type(rectangle), intent(in) :: this
65 get2 = 2.0 * this%width * this%height
71 ! { dg-final { cleanup-modules "m" } }