Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / pure_initializer_2.f90
blob4fd2556efca6d205e76647d1a3a85e037ab693a3
1 ! { dg-do compile }
2 ! PR42008 Wrongly rejected derived types with default initializers
3 ! in PURE procedures
4 module mod_xyz
5 implicit none
6 contains
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
13 end module mod_xyz
15 module mod_xyz2
16 implicit none
17 contains
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
27 end module mod_xyz2
29 module mod_xyz3
30 implicit none
31 type ilist
32 type(ilist), pointer :: next => null() ! Valid
33 integer :: i
34 end type ilist
35 contains
36 pure subroutine psub()
37 type(ilist) :: var ! Valid
38 end subroutine psub
39 end module mod_xyz3
41 pure function test()
42 integer,pointer :: p => null() !{ dg-error "not allowed in a PURE procedure" }
43 integer :: test
44 test = p
45 end function test
46 ! { dg-final { cleanup-modules "mod_xyz mod_xyz2 mod_xyz3" } }