1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3module m2
4  public s2, s4
5  private s3
6contains
7  subroutine s2
8  end
9  subroutine s3
10  end
11  subroutine s4
12  end
13end module
14
15module m
16  use m2
17  external bar
18  interface
19    subroutine foo
20    end subroutine
21  end interface
22  integer :: i
23  type t1
24    integer :: c
25  contains
26    !ERROR: The binding of 'a' ('missing') must be either an accessible module procedure or an external procedure with an explicit interface
27    procedure, nopass :: a => missing
28    procedure, nopass :: b => s, s2
29    !ERROR: Type parameter, component, or procedure binding 'c' already defined in this type
30    procedure, nopass :: c
31    !ERROR: DEFERRED is only allowed when an interface-name is provided
32    procedure, nopass, deferred :: d => s
33    !Note: s3 not found because it's not accessible -- should we issue a message
34    !to that effect?
35    !ERROR: 's3' must be either an accessible module procedure or an external procedure with an explicit interface
36    procedure, nopass :: s3
37    procedure, nopass :: foo
38    !ERROR: 'bar' must be either an accessible module procedure or an external procedure with an explicit interface
39    procedure, nopass :: bar
40    !ERROR: 'i' must be either an accessible module procedure or an external procedure with an explicit interface
41    procedure, nopass :: i
42    !ERROR: Type parameter, component, or procedure binding 'b' already defined in this type
43    procedure, nopass :: b => s4
44    !ERROR: DEFERRED is required when an interface-name is provided
45    procedure(foo), nopass :: g
46  end type
47  type, abstract :: t1a ! DEFERRED valid only in ABSTRACT derived type
48  contains
49    procedure(foo), nopass, deferred :: e
50    procedure(s), nopass, deferred :: f
51    !ERROR: Type parameter, component, or procedure binding 'f' already defined in this type
52    procedure(foo), nopass, deferred :: f
53    !ERROR: 'bar' must be an abstract interface or a procedure with an explicit interface
54    procedure(bar), nopass, deferred :: h
55  end type
56  type t2
57    integer :: i
58  contains
59    procedure, nopass :: b => s
60    final :: f
61    !ERROR: FINAL subroutine 'i' of derived type 't2' must be a module procedure
62    final :: i
63  end type
64  type t3
65  contains
66    private
67    procedure, nopass :: b => s
68    procedure, nopass, public :: f
69  end type
70contains
71  subroutine s
72  end
73  subroutine f(x)
74    type(t2) :: x
75  end
76end module
77