aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_proc_23.f90
blob: 0109c7478de44e8c340b0287fbd5438460a7153a (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
! { dg-do run }
!
! PR 49562: [4.6/4.7 Regression] [OOP] assigning value to type-bound function
!
! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>

module ice
  type::ice_type
   contains
     procedure::ice_func
  end type
  integer, target :: it = 0
contains
  function ice_func(this)
    integer, pointer :: ice_func
    class(ice_type)::this
    ice_func => it
  end function ice_func
  subroutine ice_sub(a)
    class(ice_type)::a
    a%ice_func() = 1
  end subroutine ice_sub
end module

use ice
type(ice_type) :: t
if (it/=0) call abort()
call ice_sub(t)
if (it/=1) call abort()
end