1! { dg-do compile }
2! Tests patch for problem that was found whilst investigating
3! PR24158. The call to foo would cause an ICE because the
4! actual argument was of a type that was not defined.  The USE
5! GLOBAL was commented out, following the fix for PR29364.
6!
7! Contributed by Paul Thomas <pault@gcc.gnu.org>
8!
9module global
10  type :: t2
11    type(t3), pointer :: d ! { dg-error "has not been declared" }
12  end type t2
13end module global
14
15program snafu
16!  use global
17  implicit type (t3) (z)
18
19  call foo (zin) ! { dg-error "defined|Type mismatch" }
20
21contains
22
23  subroutine foo (z)
24
25    type :: t3
26      integer :: i
27    end type t3
28
29    type(t3)  :: z
30    z%i = 1
31
32  end subroutine foo
33end program snafu
34