1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
2module m
3  abstract interface
4    subroutine foo
5    end subroutine
6  end interface
7
8  procedure() :: a
9  procedure(integer) :: b
10  procedure(foo) :: c
11  procedure(bar) :: d
12  !ERROR: 'missing' must be an abstract interface or a procedure with an explicit interface
13  procedure(missing) :: e
14  !ERROR: 'b' must be an abstract interface or a procedure with an explicit interface
15  procedure(b) :: f
16  procedure(c) :: g
17  external :: h
18  !ERROR: 'h' must be an abstract interface or a procedure with an explicit interface
19  procedure(h) :: i
20  procedure(forward) :: j
21  !ERROR: 'bad1' must be an abstract interface or a procedure with an explicit interface
22  procedure(bad1) :: k1
23  !ERROR: 'bad2' must be an abstract interface or a procedure with an explicit interface
24  procedure(bad2) :: k2
25  !ERROR: 'bad3' must be an abstract interface or a procedure with an explicit interface
26  procedure(bad3) :: k3
27
28  abstract interface
29    subroutine forward
30    end subroutine
31  end interface
32
33  real :: bad1(1)
34  real :: bad2
35  type :: bad3
36  end type
37
38  type :: m ! the name of a module can be used as a local identifier
39  end type m
40
41  external :: a, b, c, d
42  !ERROR: EXTERNAL attribute not allowed on 'm'
43  external :: m
44  !ERROR: EXTERNAL attribute not allowed on 'foo'
45  external :: foo
46  !ERROR: EXTERNAL attribute not allowed on 'bar'
47  external :: bar
48
49  !ERROR: PARAMETER attribute not allowed on 'm'
50  parameter(m=2)
51  !ERROR: PARAMETER attribute not allowed on 'foo'
52  parameter(foo=2)
53  !ERROR: PARAMETER attribute not allowed on 'bar'
54  parameter(bar=2)
55
56  type, abstract :: t1
57    integer :: i
58  contains
59    !ERROR: 'proc' must be an abstract interface or a procedure with an explicit interface
60    !ERROR: Procedure component 'p1' has invalid interface 'proc'
61    procedure(proc), deferred :: p1
62  end type t1
63
64contains
65  subroutine bar
66  end subroutine
67end module
68