1! { dg-do compile }
2!
3! PR fortran/42769
4! This test used to ICE in resolve_typebound_procedure because T1's GET
5! procedure was wrongly associated to MOD2's MY_GET (instead of the original
6! MOD1's MY_GET) in MOD3's SUB.
7!
8! Original testcase by Salvator Filippone <sfilippone@uniroma2.it>
9! Reduced by Janus Weil <janus@gcc.gnu.org>
10
11module mod1
12  type :: t1
13  contains
14    procedure, nopass :: get => my_get
15  end type
16contains
17  logical function my_get()
18  end function
19end module
20
21module mod2
22contains
23  logical function my_get()
24  end function
25end module
26
27module mod3
28contains
29  subroutine sub(a)
30    use mod2, only: my_get
31    use mod1, only: t1
32    type(t1) :: a
33  end subroutine
34end module
35
36
37use mod2, only: my_get
38use mod3, only: sub
39end
40
41
42
43