summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/ptr-func-2.f90
blob: 8275f14c789f0453a111b0692ec048bf24fec8f4 (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
! { dg-do compile }
! { dg-options "-std=f2003 -fall-intrinsics" }
!
! PR fortran/46100
!
! Pointer function as definable actual argument
! - a Fortran 2008 feature
!
integer, target :: tgt
call one (two ()) ! { dg-error "Fortran 2008: Pointer functions" }
if (tgt /= 774) call abort ()
contains
  subroutine one (x)
    integer, intent(inout) :: x
    if (x /= 34) call abort ()
    x = 774
  end subroutine one
  function two ()
    integer, pointer :: two
    two => tgt 
    two = 34
  end function two
end