aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_proc_22.f90
blob: 2d9f17c564f69fe29b9905d8eb31078010aaca83 (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
! { dg-do compile }
!
! PR fortran/48810
!
! Contributed by Andrew Baldwin
!
      module qtest
      type foobar
        integer :: x
        contains
        private
        procedure :: gimmex
        generic, public :: getx => gimmex
      end type foobar
      contains
        function gimmex(foo)
          class (foobar) :: foo
          integer :: gimmex
          gimmex = foo%x
        end function gimmex
      end module qtest

      module qtestPriv
      type foobarPriv
        integer :: x
        contains
        private
        procedure :: gimmexPriv
        generic, private :: getxPriv => gimmexPriv
      end type foobarPriv
      contains
        function gimmexPriv(foo)
          class (foobarPriv) :: foo
          integer :: gimmex
          gimmex = foo%x
        end function gimmexPriv
      end module qtestPriv

      program quicktest
      use qtest
      use qtestPriv
      type (foobar) :: foo
      type (foobarPriv) :: fooPriv
      integer :: bar
      bar = foo%getx()  ! OK
      bar = fooPriv%getxPriv() ! { dg-error " is PRIVATE " }
      end program quicktest