3 ! Test the fix for PR82312.f90
5 ! Posted on Stack Overflow:
6 ! https://stackoverflow.com/questions/46369744
7 ! /gfortran-associates-wrong-type-bound-procedure/46388339#46388339
9 module minimalisticcase
12 type, public
:: DataStructure
15 procedure
, pass
:: init
=> init_data_structure
16 procedure
, pass
:: a
=> beginning_of_alphabet
19 type, public
:: DataLogger
20 type(DataStructure
), pointer :: data_structure
22 procedure
, pass
:: init
=> init_data_logger
23 procedure
, pass
:: do_something
=> do_something
29 subroutine init_data_structure(self
)
31 class(DataStructure
), intent(inout
) :: self
32 write(*,*) 'init_data_structure'
36 subroutine beginning_of_alphabet(self
)
38 class(DataStructure
), intent(inout
) :: self
40 write(*,*) 'beginning_of_alphabet'
44 subroutine init_data_logger(self
, data_structure
)
46 class(DataLogger
), intent(inout
) :: self
47 class(DataStructure
), target
:: data_structure
48 write(*,*) 'init_data_logger'
51 self
%data_structure
=> data_structure
! Invalid change of 'self' vptr
52 call self
%do_something()
55 subroutine do_something(self
)
57 class(DataLogger
), intent(inout
) :: self
59 write(*,*) 'do_something'
69 type(DataStructure
) :: data_structure
70 type(DataLogger
) :: data_logger
72 call data_structure
%init()
73 call data_structure
%a()
74 call data_logger
%init(data_structure
)
76 if (ctr
.ne
. 1111) STOP 1