view gcc/testsuite/gfortran.dg/pure_formal_3.f90 @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900 (2018-10-24)
parents 04ced10e8804
children 1830386684a0
line wrap: on
line source
! { dg-do compile }
!
! Clean up, made when working on PR fortran/52864
!
! Test some PURE and intent checks - related to pointers.
module m
  type t
  end type t
  integer, pointer :: x
  class(t), pointer :: y
end module m

pure subroutine foo()
  use m
  call bar(x) ! { dg-error "can not appear in a variable definition context" }
  call bar2(x) ! { dg-error "is local to a PURE procedure and has the POINTER attribute" }
  call bb(y) ! { dg-error "is local to a PURE procedure and has the POINTER attribute" }
contains
  pure subroutine bar(x)
    integer, pointer, intent(inout) :: x
  end subroutine
  pure subroutine bar2(x)
    integer, pointer :: x
  end subroutine
  pure subroutine bb(x)
    class(t), pointer, intent(in) :: x 
  end subroutine
end subroutine