37 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Test polymorphic restrictions3module m4 type base5 end type6 type, extends(base) :: t7 integer n8 contains9 procedure :: fwrite10 generic :: write(formatted) => fwrite11 end type12 type, extends(t) :: t213 end type14 contains15 subroutine fwrite(x, unit, iotype, vlist, iostat, iomsg)16 class(t), intent(in) :: x17 integer, intent(in) :: unit18 character(*), intent(in) :: iotype19 integer, intent(in) :: vlist(:)20 integer, intent(out) :: iostat21 character(*), intent(in out) :: iomsg22 write(unit, *, iostat=iostat, iomsg=iomsg) '(', iotype, ':', vlist, ':', x%n, ')'23 end subroutine24 subroutine subr(x, y, z, w)25 class(t), intent(in) :: x26 class(base), intent(in) :: y27 class(*), intent(in) :: z28 class(t2), intent(in) :: w29 print *, x ! ok30 print *, w ! ok31 !ERROR: Derived type 'base' in I/O may not be polymorphic unless using defined I/O32 print *, y33 !ERROR: I/O list item may not be unlimited polymorphic34 print *, z35 end subroutine36end37