Merge with trank @ 137446
[official-gcc.git] / gcc / testsuite / gfortran.dg / finalize_8.f03
blob6a4a135e0da02076c38fd08fadda7157fddb52a7
1 ! { dg-do compile }
3 ! Parsing of finalizer procedure definitions.
4 ! Check that FINAL-declarations are only allowed on types defined in the
5 ! specification part of a module.
7 MODULE final_type
8   IMPLICIT NONE
10 CONTAINS
12   SUBROUTINE bar
13     IMPLICIT NONE
15     TYPE :: mytype
16       INTEGER, ALLOCATABLE :: fooarr(:)
17       REAL :: foobar
18     CONTAINS
19       FINAL :: myfinal ! { dg-error "in the specification part of a MODULE" }
20     END TYPE mytype
22   CONTAINS
24     SUBROUTINE myfinal (el)
25       TYPE(mytype) :: el
26     END SUBROUTINE myfinal
28   END SUBROUTINE bar
30 END MODULE final_type
32 PROGRAM finalizer
33   IMPLICIT NONE
34   ! Do nothing here
35 END PROGRAM finalizer
37 ! { dg-final { cleanup-modules "final_type" } }