1! { dg-do compile }
2! Check that we don't allow IO or NAMELISTs with types with allocatable
3! components (PR 20541)
4program main
5
6    type :: foo
7        integer, allocatable :: x(:)
8    end type foo
9
10    type :: bar
11        type(foo) :: x
12    end type bar
13
14    type(foo) :: a
15    type(bar) :: b
16    namelist /blah/ a ! { dg-error "has ALLOCATABLE or POINTER components and thus requires a defined input/output" }
17
18    write (*, *) a  ! { dg-error "cannot have ALLOCATABLE components" }
19
20    read (*, *) b  ! { dg-error "cannot have ALLOCATABLE components" }
21
22end program main
23