Debian Codegraph @

gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR 63674: [F03] procedure pointer and non/pure procedure
4 !
5 ! Contributed by Valery Weber <[email protected]>
6
7 program prog
8 interface
9 integer function nf()
10 end function
11 pure integer function pf()
12 end function
13 subroutine ns()
14 end subroutine
15 pure subroutine ps()
16 end subroutine
17 end interface
18 type :: t
19 procedure(nf), nopass, pointer :: nf => NULL() ! non-pure function
20 procedure(pf), nopass, pointer :: pf => NULL() ! pure function
21 procedure(ns), nopass, pointer :: ns => NULL() ! non-pure subroutine
22 procedure(ps), nopass, pointer :: ps => NULL() ! pure subroutine
23 end type
24 contains
25 pure integer function eval(a)
26 type(t), intent(in) :: a
27 eval = a%pf()
28 eval = a%nf() ! { dg-error "Reference to impure function" }
29 call a%ps()
30 call a%ns() ! { dg-error "is not PURE" }
31 end function
32 end