summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pointer_init_6.f90
blob: 92cece3a8edae622e539b9a0a4a9f7e767e7a2bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
! { dg-do compile }
!
! PR 45290: [F08] pointer initialization
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

module m1
 implicit none
 type :: t
   integer, pointer :: p
   integer :: i
 end type
 integer, target :: i
 type(t), target :: x
 integer, pointer :: p1 => i
 integer, pointer :: p2 => p1   ! { dg-error "must have the TARGET attribute" }
 integer, pointer :: p3 => x%p  ! { dg-error "must have the TARGET attribute" }
 integer, pointer :: p4 => x%i
end module m1


module m2

 type :: t
   procedure(s), pointer, nopass :: ppc
 end type
 type(t) :: x
 procedure(s), pointer :: pp1 => s
 procedure(s), pointer :: pp2 => pp1    ! { dg-error "may not be a procedure pointer" }
 procedure(s), pointer :: pp3 => t%ppc  ! { dg-error "Syntax error" }

contains

  subroutine s
  end subroutine

end module m2

! { dg-final { cleanup-modules "m1 m2" } }