| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 54756: [OOP] [F08] Should reject CLASS, intent(out) in PURE procedures |
| 4 |
! |
| 5 |
! Contributed by Tobias Burnus <[email protected]> |
| 6 |
|
| 7 |
module m |
| 8 |
type t |
| 9 |
contains |
| 10 |
final :: fnl ! impure finalizer |
| 11 |
end type t |
| 12 |
contains |
| 13 |
impure subroutine fnl(x) |
| 14 |
type(t) :: x |
| 15 |
print *,"finalized!" |
| 16 |
end subroutine |
| 17 |
end |
| 18 |
|
| 19 |
program test |
| 20 |
use m |
| 21 |
type(t) :: x |
| 22 |
call foo(x) |
| 23 |
contains |
| 24 |
pure subroutine foo(x) ! { dg-error "may not be polymorphic" } |
| 25 |
! pure subroutine would call impure finalizer |
| 26 |
class(t), intent(out) :: x |
| 27 |
end subroutine |
| 28 |
end |