view gcc/testsuite/gfortran.dg/class_dummy_5.f90 @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { 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