1! { dg-do compile } 2! PR42008 Wrongly rejected derived types with default initializers 3! in PURE procedures 4module mod_xyz 5 implicit none 6contains 7 pure subroutine psub() 8 type ilist 9 type(ilist), pointer :: next => null() ! Valid 10 integer :: i 11 end type ilist 12 end subroutine psub 13end module mod_xyz 14 15module mod_xyz2 16 implicit none 17contains 18 pure subroutine psub() 19 type ilist 20 type(ilist), pointer :: next 21 integer, pointer :: p => null() ! Valid 22 integer :: i 23 end type ilist 24 type(ilist) :: var ! Valid 25 var%next => null() 26 end subroutine psub 27end module mod_xyz2 28 29module mod_xyz3 30 implicit none 31 type ilist 32 type(ilist), pointer :: next => null() ! Valid 33 integer :: i 34 end type ilist 35contains 36 pure subroutine psub() 37 type(ilist) :: var ! Valid 38 end subroutine psub 39end module mod_xyz3 40 41pure function test() 42 integer,pointer :: p => null() !{ dg-error "not allowed in a PURE procedure" } 43 integer :: test 44 test = p 45end function test 46