This is a spin-off from PR42769 comment #17. The test case has been extracted
from comment #1 in that PR. It was working before r157272 (which fixed
PR43256), but fails now:

module m1
  type  :: t1
  contains 
    procedure :: sizeof
  end type
contains
  integer function sizeof(a)
    class(t1) :: a
  end function sizeof
end module


module m2
  use m1
  type, extends(t1) :: t2    
  contains
    procedure :: sizeof => sizeof2
  end type
contains
  integer function sizeof2(a)
    class(t2) :: a
  end function
end module


module m3
  use m2
  type :: t3
    class(t1), allocatable  :: a 
  contains
    procedure :: sizeof => sizeof3
  end type
contains 
  integer function sizeof3(a)
    class(t3) :: a
    sizeof3 = a%a%sizeof()
  end function 
end module



    sizeof3 = a%a%sizeof()
              1
Error: Type mismatch in argument 'a' at (1); passed CLASS(t1) to CLASS(t2)


-- 
           Summary: [4.5 regression] [OOP] Type mismatch in argument; passed
                    CLASS(t1) to CLASS(t2)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


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

Reply via email to