Derived-type io

Derived-type io

Ritratto di simong

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).

Thanks.

module points
  implicit none
  type point
     real :: m_p(3)
   contains
     procedure, public :: write_f_point
     generic           :: write(formatted) => write_f_point
     procedure, public :: print => print_point
  end type point
contains
  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 14.0.0.051 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 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Steve Lionel (Intel)

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.

Steve
Ritratto di simong

Thanks - I'll take it to Premier Support.

Accedere per lasciare un commento.