1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
2program p
3  integer :: p ! this is ok
4end
5module m
6  integer :: m ! this is ok
7end
8submodule(m) sm
9  integer :: sm ! this is ok
10end
11module m2
12  type :: t
13  end type
14  interface
15    subroutine s
16      !ERROR: Module 'm2' cannot USE itself
17      use m2, only: t
18    end subroutine
19  end interface
20end module
21subroutine s
22  !ERROR: 's' is already declared in this scoping unit
23  integer :: s
24end
25function f() result(res)
26  integer :: res
27  !ERROR: 'f' is already declared in this scoping unit
28  !ERROR: The type of 'f' has already been declared
29  real :: f
30  res = 1
31end
32