1! { dg-do compile }
2! PR fortran/33917
3!
4! Depending, in which order the symbol tree
5! was walked in resolve, gfortran resolved
6! p6 before p4; thus there was no explicit
7! interface available for p4 and an error
8! was printed. (This is a variant of proc_decl_2.f90)
9!
10! Additionally, the following contrain was not honoured:
11! "C1212 (R1215) [...] If name is declared by a procedure-declaration-stmt
12! it shall be previously declared." ("name" = interface-name)
13!
14program s
15  implicit none
16  procedure() :: q2
17  procedure() :: q3
18  procedure() :: q5
19  procedure(sub) :: p4
20  procedure(p4) :: p6
21contains
22  subroutine sub
23  end subroutine
24end program s
25
26subroutine test
27  implicit none
28  abstract interface
29    subroutine sub()
30    end subroutine sub
31  end interface
32  procedure(p4) :: p6 ! { dg-error "declared in a later PROCEDURE statement" }
33  procedure(sub) :: p4
34end subroutine test
35