aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/class_dummy_5.f90
blob: 78fc4f8c622507118963b65929341e2249f226f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
! { dg-do compile }
!
! PR 54756: [OOP] [F08] Should reject CLASS, intent(out) in PURE procedures
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>

module m
  type t
  contains
    final :: fnl   ! impure finalizer
  end type t
contains
  impure subroutine fnl(x)
    type(t) :: x
    print *,"finalized!"
  end subroutine
end

program test
  use m
  type(t) :: x
  call foo(x)
contains
  pure subroutine foo(x)  ! { dg-error "may not be polymorphic" }
    ! pure subroutine would call impure finalizer
    class(t), intent(out) :: x
  end subroutine
end