Debian Codegraph @

gcc/testsuite/gfortran.dg/extends_10.f03

raw
1 ! { dg-do compile }
2 !
3 ! PR 42545: type extension: parent component has wrong accessibility
4 !
5 ! Reported by Reinhold Bader <[email protected]>
6
7 module mo
8 implicit none
9 type :: t1
10 integer :: i = 1
11 end type
12 type, extends(t1) :: t2
13 private
14 real :: x = 2.0
15 end type
16 type :: u1
17 integer :: j = 1
18 end type
19 type, extends(u1) :: u2
20 real :: y = 2.0
21 end type
22 private :: u1
23 end module
24
25 program pr
26 use mo
27 implicit none
28 type(t2) :: a
29 type(u2) :: b
30 print *,a%t1%i
31 print *,b%u1%j ! { dg-error "is a PRIVATE component of" }
32 end program