aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_proc_10.f03
blob: cbb61b6caa3c555a61f6e1628ef7628605c739f6 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
! { dg-do compile }

! Type-bound procedures
! Test for resolution errors with DEFERRED, namely checks about invalid
! overriding and taking into account inherited DEFERRED bindings.
! Also check that DEFERRED attribute is saved to module correctly.

MODULE m1
  IMPLICIT NONE

  ABSTRACT INTERFACE
    SUBROUTINE intf ()
    END SUBROUTINE intf
  END INTERFACE

  TYPE, ABSTRACT :: abstract_type
  CONTAINS
    PROCEDURE(intf), DEFERRED, NOPASS :: def
    PROCEDURE, NOPASS :: nodef => realproc
  END TYPE abstract_type

CONTAINS

  SUBROUTINE realproc ()
  END SUBROUTINE realproc

END MODULE m1

MODULE m2
  USE m1
  IMPLICIT NONE

  TYPE, ABSTRACT, EXTENDS(abstract_type) :: sub_type1
  CONTAINS
    PROCEDURE(intf), DEFERRED, NOPASS :: nodef ! { dg-error "must not be DEFERRED" }
  END TYPE sub_type1

  TYPE, EXTENDS(abstract_type) :: sub_type2 ! { dg-error "must be ABSTRACT" }
  END TYPE sub_type2

END MODULE m2