1! { dg-do run }
2! PR84387 Defined output does not work for a derived type that
3! has no components
4module m
5   type :: t
6      private
7      !integer :: m_i = 0  !<-- ***
8   contains
9      private
10      procedure, pass(this) :: write_t
11      generic, public :: write(formatted) => write_t
12   end type
13contains
14   subroutine write_t(this, lun, iotype, vlist, istat, imsg)
15      ! argument definitions
16      class(t), intent(in)            :: this
17      integer, intent(in)             :: lun
18      character(len=*), intent(in)    :: iotype
19      integer, intent(in)             :: vlist(:)
20      integer, intent(out)            :: istat
21      character(len=*), intent(inout) :: imsg
22      write(lun, fmt=*, iostat=istat, iomsg=imsg) "Hello World!"
23      return
24   end subroutine write_t
25
26end module
27
28program p
29   use m, only : t
30   type(t) :: foo
31   print "(dt)", foo ! { dg-output " Hello World!" }
32end program
33