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

           Summary: [OOP] Polymorphic type - defined ASSIGNMENT(=) not
                    used
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
                CC: ja...@gcc.gnu.org


Reported by Damian at http://gcc.gnu.org/ml/fortran/2010-12/msg00063.html

The following program should print "defined assignment called". It does so with
the IBM compiler but not with gfortran.

module component_parent_child_module
  implicit none
  type component
  contains
    procedure :: assign
    generic :: assignment(=)=>assign
  end type
  type parent
    type(component) :: foo
  end type
  type, extends(parent) :: child
  end type
contains
  subroutine assign(lhs,rhs)
    class(component), intent(out) :: lhs
    class(component), intent(in) :: rhs
    print *,'defined assignment called'
  end subroutine 
  type(child) function new_child()
  end function
end module 

program main
  use component_parent_child_module
  implicit none
  type(child) :: infant
  infant = new_child()
end

Reply via email to