1! { dg-do compile }
2! This tests the fix for PR28526, in which a public interface named
3! 'end' would be treated as a variable because the matcher tried
4! 'END INTERFACE' as an assignment and left the symbol modified in
5! failing. The various pitfalls that were encountered in developing
6! the fix are checked here.
7!
8! Contributed by Paul Thomas  <pault@gcc.gnu.org>
9!
10module blahblah
11  public function, end
12
13! The original PR from Yusuke IGUCHI <iguchi@coral.t.u-tokyo.ac.jp>
14  interface end
15    module procedure foo1
16  end interface
17
18! A contribution to the PR from Tobias Schlueter  <tobi@gcc.gnu.org>
19  interface function
20     module procedure foo2 ! { dg-error "is neither function nor" }
21  end interface
22
23  interface function
24     module procedure foo3
25  end interface
26
27  interface
28    function foo4 ()
29      real foo4
30      x = 1.0          ! { dg-error "in INTERFACE" }
31    end function foo4
32  end interface
33
34  interface
35    x = 2.0            ! { dg-error "in INTERFACE block" }
36    function foo5 ()
37      real foo5
38    end function foo5
39  end interface
40
41  x = 3.0              ! { dg-error "in MODULE" }
42
43contains
44
45  subroutine foo1
46  end subroutine foo1
47
48  function foo2        ! { dg-error "Expected formal argument list" }
49    foo2 = 0           ! { dg-error "already been host associated" }
50  end function foo2    ! { dg-error "Expecting END MODULE" }
51
52  function foo3 ()
53    real foo3
54  end function foo3
55
56  x = 4.0              ! { dg-error "in CONTAINS section" }
57end module blahblah
58