[Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 28 17:37:00 GMT 2012


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

--- Comment #1 from janus at gcc dot gnu.org 2012-12-28 17:36:39 UTC ---
Reduced test case:


program construct_poly

  implicit none

  type :: interior
     real :: x
  end type interior

  type :: t_ptr
     class(interior), pointer :: r(:) => null()
  end type t_ptr

  type(t_ptr) :: o1
  type(interior), target :: r(3)

  o1 = t_ptr(r)

end program 


This gives me:

test.f90:16.13:

  o1 = t_ptr(r)
             1
Error: The rank of the element in the structure constructor at (1) does not
match that of the component (1/0)
test.f90:16.13:

  o1 = t_ptr(r)
             1
Error: Can't convert TYPE(interior) to CLASS(interior) at (1)


For the original test case, I get some more of these errors (on line 38, 52 and
63).



More information about the Gcc-bugs mailing list