2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / pure_initializer_2.f90
blobafb00c661ae238fdddedc7ac046b3a24825d66f8
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