view gcc/testsuite/gfortran.dg/ptr-func-1.f90 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do compile }
! { dg-options "-std=f2008 -fall-intrinsics" }
!
! PR fortran/46100
!
! Pointer function as definable actual argument
! - a Fortran 2008 feature
!
integer, target :: tgt
call one (two ())
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