summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_result_2.f90
blob: 362a1f7f84859c1fb8226e153ab88ed8977aad07 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
! { dg-do compile }
!
! PR 36704: Procedure pointer as function result
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

module proc_ptr_15

  interface
    function e(x)
      real :: x
      procedure(), pointer :: e
    end function e
  end interface

  interface
    function f(x)
      real :: x
      external :: f
      pointer :: f
    end function
  end interface

  interface
    function g(x)
      real :: x
      pointer :: g
      external :: g
    end function
  end interface

contains

  subroutine point_fun()
    call set_fun(aux)
  end subroutine

  subroutine set_fun(y)
    external :: y
  end subroutine

  function aux()
    external aux
    pointer aux
    intrinsic sin
    aux => sin
  end function

  function foo(x)
    real :: x
    interface
      subroutine foo(i)  ! { dg-error "attribute conflicts with" }
        integer :: i
      end subroutine
    end interface
    !pointer :: foo
  end function

end

! { dg-final { cleanup-modules "proc_ptr_15" } }