| 1 |
! { dg-do run } |
| 2 |
! { dg-compile-aux-modules "pr117730_a.f90" } |
| 3 |
! { dg-additional-sources pr117730_a.f90 } |
| 4 |
! |
| 5 |
! Test the fix for PR117730 in which the non_overrridable procedures in |
| 6 |
! pr117730_a.f90 were mixied up in the vtable for 'child2' below. This resulted |
| 7 |
! in 'this%calc()' in 'function child_get(this)' returning garbage. |
| 8 |
! |
| 9 |
! Contributed by <[email protected]> in comment 4 of PR84674. |
| 10 |
! |
| 11 |
module module2 |
| 12 |
use module1, only: child |
| 13 |
|
| 14 |
implicit none |
| 15 |
private |
| 16 |
public :: child2 |
| 17 |
|
| 18 |
type, extends(child) :: child2 |
| 19 |
contains |
| 20 |
procedure, pass :: calc => child2_calc |
| 21 |
end type child2 |
| 22 |
|
| 23 |
contains |
| 24 |
|
| 25 |
pure function child2_calc(this) result(value) |
| 26 |
class(child2), intent(in) :: this |
| 27 |
integer :: value |
| 28 |
|
| 29 |
value = 1 |
| 30 |
end function child2_calc |
| 31 |
|
| 32 |
end module module2 |
| 33 |
|
| 34 |
program test |
| 35 |
use module2, only: child2 |
| 36 |
|
| 37 |
implicit none |
| 38 |
|
| 39 |
type(child2) :: F |
| 40 |
|
| 41 |
if (F%calc() /= 1) stop 1 |
| 42 |
|
| 43 |
print *, "---------------" |
| 44 |
if (F%get() /= 1) stop 2 |
| 45 |
|
| 46 |
end program test |
| 47 |
! { dg-final { cleanup-modules "module1" } } |