https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #12 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 40305
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40305&action=edit
Patch for the PR

That attachment appears to fix the testcases of comments #6 and #9. This check
of comment #6 runs OK:

module object_interface
  type, abstract :: object
  contains
    procedure(write_formatted_interface), deferred :: write_formatted
    generic :: write(formatted) => write_formatted
  end type
  abstract interface
    subroutine write_formatted_interface(this,unit,iotype,vlist,iostat,iomsg)
      import object
      class(object), intent(in) :: this
      integer, intent(in) :: unit
      character (len=*), intent(in) :: iotype
      integer, intent(in) :: vlist(:)
      integer, intent(out) :: iostat
      character (len=*), intent(inout) :: iomsg
    end subroutine
  end interface
  type, extends(object) :: non_abstract_child
    integer :: i
  contains
    procedure :: write_formatted
  end type
contains
  subroutine write_formatted(this,unit,iotype,vlist,iostat,iomsg)
    class(non_abstract_child), intent(in) :: this
    integer, intent(in) :: unit
    character (len=*), intent(in) :: iotype
    integer, intent(in) :: vlist(:)
    integer, intent(out) :: iostat
    character (len=*), intent(inout) :: iomsg
    select type (this)
      class is (non_abstract_child)
        print *, this%i
      class default
        print *, "Error"
    end select
  end subroutine
  subroutine assert(a)
    class(object):: a
    write(*,*) a
  end subroutine
end module

  use object_interface
  class (object), allocatable :: z
  allocate (z, source = non_abstract_child (99))
  call assert (z)
end

The patch bootstraps and regtests OK. Will submit tomorrow.

Paul

Reply via email to