Derived-type io

Derived-type io

I'm trying to use derived-type io which is on the list of new features but can't get my code to compile. I've stared at the code for too long now so hopefully some fresh eyes will immediately spot my mistake(s).


module points
  implicit none
  type point
     real :: m_p(3)
     procedure, public :: write_f_point
     generic           :: write(formatted) => write_f_point
     procedure, public :: print => print_point
  end type point
  subroutine print_point(this)
    class(point), intent(in) :: this
    write(*,'(dt)') this
  end subroutine print_point
  subroutine write_f_point(this, u, iotype, v_list, iostat, iomsg)
    class(point), intent(in)    :: this
    integer, intent(in)         :: u
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg
    iostat = 0
    write(*,fmt='(3(a,f0.4),a)') '(',this%m_p(1),',',this%m_p(2),',',this%m_p(3),')'
  end subroutine write_f_point
end module points

ifort -V -o points.o -c points.f90
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version Beta Build 20130529
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

ifort: NOTE: The Beta evaluation period for this product ends on 27-sep-2013 UTC.
 Intel(R) Fortran 14.0-1530
points.f90(17): error #8309: A list item shall not be polymorphic unless it is processed by a user-defined derived-type input/output procedure.   [THIS]
    write(*,'(dt)') this
compilation aborted for points.f90 (code 1)

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please use Intel Premier Support for all beta issues. But before you do that, try the beta update which is now available. We fixed many issues in DTIO. I think what you're doing should be ok.

Retired 12/31/2016

Thanks - I'll take it to Premier Support.

Leave a Comment

Please sign in to add a comment. Not a member? Join today