1! RUN: %python %S/test_errors.py %s %flang_fc1 2! Test polymorphic restrictions 3module m 4 type base 5 end type 6 type, extends(base) :: t 7 integer n 8 contains 9 procedure :: fwrite 10 generic :: write(formatted) => fwrite 11 end type 12 type, extends(t) :: t2 13 end type 14 contains 15 subroutine fwrite(x, unit, iotype, vlist, iostat, iomsg) 16 class(t), intent(in) :: x 17 integer, intent(in) :: unit 18 character(*), intent(in) :: iotype 19 integer, intent(in) :: vlist(:) 20 integer, intent(out) :: iostat 21 character(*), intent(in out) :: iomsg 22 write(unit, *, iostat=iostat, iomsg=iomsg) '(', iotype, ':', vlist, ':', x%n, ')' 23 end subroutine 24 subroutine subr(x, y, z, w) 25 class(t), intent(in) :: x 26 class(base), intent(in) :: y 27 class(*), intent(in) :: z 28 class(t2), intent(in) :: w 29 print *, x ! ok 30 print *, w ! ok 31 !ERROR: Derived type 'base' in I/O may not be polymorphic unless using defined I/O 32 print *, y 33 !ERROR: I/O list item may not be unlimited polymorphic 34 print *, z 35 end subroutine 36end 37