aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/proc_ptr_41.f90
blob: 7f50abab21a91a6ab416fb162969e8350b4075a4 (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
! { dg-do compile }
!
! PR 56968: [4.7/4.8/4.9 Regression] [F03] Issue with a procedure defined with a generic name returning procedure pointer
!
! Contributed by Samuel Debionne <samuel.debionne@ujf-grenoble.fr>

module test

  interface generic_name_get_proc_ptr
    module procedure specific_name_get_proc_ptr
  end interface

  abstract interface
    double precision function foo(arg1)
      real, intent(in) :: arg1
    end function
  end interface

contains

  function specific_name_get_proc_ptr() result(res)
    procedure(foo), pointer :: res
  end function

end module test

program crash_test
    use :: test

    procedure(foo), pointer :: ptr

    ptr => specific_name_get_proc_ptr()
    ptr => generic_name_get_proc_ptr()

end program

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