| 1 |
! { dg-do compile } |
| 2 |
! Test the final fix for PR42353, in which a compilation error was |
| 3 |
! occurring because the derived type of the initializer of the vtab |
| 4 |
! component '$extends' was not the same as that of the component. |
| 5 |
! |
| 6 |
! Contributed by Harald Anlauf <[email protected]> |
| 7 |
! |
| 8 |
module abstract_vector |
| 9 |
implicit none |
| 10 |
|
| 11 |
type, abstract :: vector_class |
| 12 |
end type vector_class |
| 13 |
end module abstract_vector |
| 14 |
!------------------------- |
| 15 |
module concrete_vector |
| 16 |
use abstract_vector |
| 17 |
implicit none |
| 18 |
|
| 19 |
type, extends(vector_class) :: trivial_vector_type |
| 20 |
end type trivial_vector_type |
| 21 |
|
| 22 |
private :: my_assign |
| 23 |
contains |
| 24 |
subroutine my_assign (this,v) |
| 25 |
class(trivial_vector_type), intent(inout) :: this |
| 26 |
class(vector_class), intent(in) :: v |
| 27 |
end subroutine my_assign |
| 28 |
end module concrete_vector |
| 29 |
!--------------------------- |
| 30 |
module concrete_gradient |
| 31 |
use abstract_vector |
| 32 |
implicit none |
| 33 |
|
| 34 |
type, abstract, extends(vector_class) :: gradient_class |
| 35 |
end type gradient_class |
| 36 |
|
| 37 |
type, extends(gradient_class) :: trivial_gradient_type |
| 38 |
end type trivial_gradient_type |
| 39 |
|
| 40 |
private :: my_assign |
| 41 |
contains |
| 42 |
subroutine my_assign (this,v) |
| 43 |
class(trivial_gradient_type), intent(inout) :: this |
| 44 |
class(vector_class), intent(in) :: v |
| 45 |
end subroutine my_assign |
| 46 |
end module concrete_gradient |
| 47 |
!---------------------------- |
| 48 |
module concrete_inner_product |
| 49 |
use concrete_vector |
| 50 |
use concrete_gradient |
| 51 |
implicit none |
| 52 |
end module concrete_inner_product |