blob: f7691c5f283d15a44c3dc0943b420473d8339ff2 (
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
|
! { 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
! { dg-final { cleanup-modules "qtest qtestpriv" } }
|