view gcc/testsuite/gfortran.dg/ptr-func-2.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do compile }
! { dg-options "-std=f2003 " }
!
! 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) STOP 1
contains
  subroutine one (x)
    integer, intent(inout) :: x
    if (x /= 34) STOP 2
    x = 774
  end subroutine one
  function two ()
    integer, pointer :: two
    two => tgt 
    two = 34
  end function two
end