| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 46161: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
implicit none |
| 8 |
|
| 9 |
type :: base |
| 10 |
end type |
| 11 |
|
| 12 |
type, extends(base) :: ext |
| 13 |
end type |
| 14 |
|
| 15 |
type(base), allocatable :: a |
| 16 |
class(base), pointer :: b |
| 17 |
class(ext), allocatable :: c |
| 18 |
|
| 19 |
call test(a) ! { dg-error "must be polymorphic" } |
| 20 |
call test(b) ! { dg-error "must be ALLOCATABLE" } |
| 21 |
call test(c) ! { dg-error "must have the same declared type" } |
| 22 |
|
| 23 |
contains |
| 24 |
|
| 25 |
subroutine test(arg) |
| 26 |
implicit none |
| 27 |
class(base), allocatable :: arg |
| 28 |
end subroutine |
| 29 |
|
| 30 |
end |