1! { dg-do compile } 2! PR 23843 3! IO of derived types with private components is allowed in the module itself, 4! but not elsewhere 5module gfortran2 6 type :: tp1 7 private 8 integer :: i 9 end type tp1 10 11 type :: tp1b 12 integer :: i 13 end type tp1b 14 15 type :: tp2 16 real :: a 17 type(tp1) :: t 18 end type tp2 19 20contains 21 22 subroutine test() 23 type(tp1) :: x 24 type(tp2) :: y 25 26 write (*, *) x 27 write (*, *) y 28 end subroutine test 29 30end module gfortran2 31 32program prog 33 34 use gfortran2 35 36 implicit none 37 type :: tp3 38 type(tp2) :: t 39 end type tp3 40 type :: tp3b 41 type(tp1b) :: t 42 end type tp3b 43 44 type(tp1) :: x 45 type(tp2) :: y 46 type(tp3) :: z 47 type(tp3b) :: zb 48 49 write (*, *) x ! { dg-error "PRIVATE components" } 50 write (*, *) y ! { dg-error "PRIVATE components" } 51 write (*, *) z ! { dg-error "PRIVATE components" } 52 write (*, *) zb 53end program prog 54