1! { dg-do compile }
2! One of the tests of the patch for PR30068.
3! Taken from the fortran 2003 standard C11.2.
4!
5! The standard specifies that the optional arguments should be
6! ignored in the counting of like type/kind, so the specific
7! procedures below are invalid, even though actually unambiguous.
8!
9INTERFACE BAD8
10  SUBROUTINE S8A(X,Y,Z)
11    REAL,OPTIONAL :: X
12    INTEGER :: Y
13    REAL :: Z
14  END SUBROUTINE S8A
15  SUBROUTINE S8B(X,Z,Y)
16    INTEGER,OPTIONAL :: X
17    INTEGER :: Z
18    REAL :: Y
19  END SUBROUTINE S8B ! { dg-error "Ambiguous interfaces" }
20END INTERFACE BAD8
21real :: a, b
22integer :: i, j
23call bad8(x,i,b)
24end
25