summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_49.f90
blob: cb540a4f548f0387ce7eb739e30ab1cb7aeb85fe (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
! { dg-do compile }
!
! Tests the fix for PRs 78013 and 61420, both of which gave a
! no IMPLICIT type message for the procedure pointer at assignment.
!
module m

  implicit none

  abstract interface
    function I_f() result( r )
      real :: r
    end function I_f
  end interface

  type, abstract :: a_t
    private
    procedure(I_f), nopass, pointer :: m_f => null()
  contains
    private
    procedure, pass(this), public :: f => get_f
  end type a_t

contains

  function get_f( this ) result( f_ptr )  ! Error message here.
    class(a_t), intent(in)  :: this
    procedure(I_f), pointer :: f_ptr
    f_ptr => this%m_f                     ! Error here :-)
  end function get_f

end module m

module test
  implicit none

  type functions
  contains
    procedure, nopass :: get_pf => get_it ! Error here
  end type

  class(functions), allocatable :: f

contains

  function get_it()                      ! Error message here.
    procedure (real), pointer :: get_it
  end function

end module