1! { dg-do compile }
2! Tests the fix for PR28630, in which a contained,
3! derived type function caused an ICE if its definition
4! was both host and use associated.
5!
6! Contributed by Mark Hesselink <mhesseli@alumni.caltech.edu>
7!
8MODULE types
9   TYPE :: t
10      INTEGER :: i
11   END TYPE
12END MODULE types
13
14MODULE foo
15   USE types
16CONTAINS
17   FUNCTION bar (x) RESULT(r)
18      USE types
19      REAL, INTENT(IN) :: x
20      TYPE(t) :: r
21      r = t(0)
22   END FUNCTION bar
23END MODULE
24
25
26LOGICAL FUNCTION foobar (x)
27   USE foo
28   REAL, INTENT(IN) :: x
29   TYPE(t) :: c
30   foobar = .FALSE.
31   c = bar (x)
32END FUNCTION foobar
33