fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / used_types_8.f90
blob58d2084f3629f038cea1d4d018f249dbbdd1442b
1 ! { dg-do compile }
2 ! Tests the fix for a further regression caused by the
3 ! fix for PR28788 and posted as PR28908. The problem was
4 ! caused by the patch preventing interface derived types
5 ! from associating with identical derived types in the
6 ! containing namespaces.
8 ! Contributed by HJ Lu <hjl@lucon.org>
10 module bar
11 implicit none
12 public
13 type ESMF_Time
14 sequence
15 integer :: MM
16 end type
17 public operator (+)
18 private add
19 interface operator (+)
20 module procedure add
21 end interface
22 contains
23 function add (x, y)
24 type(ESMF_Time) :: add
25 type(ESMF_Time), intent(in) :: x
26 type(ESMF_Time), intent(in) :: y
27 add = x
28 end function add
29 end module bar
31 module foo
32 use bar
33 implicit none
34 private
35 type ESMF_Clock
36 sequence
37 type(ESMF_Time) :: CurrTime
38 end type
39 contains
40 subroutine ESMF_ClockAdvance(clock)
41 use bar
42 type(ESMF_Clock), intent(inout) :: clock
43 clock%CurrTime = clock%CurrTime + clock%CurrTime
44 end subroutine ESMF_ClockAdvance
45 end module foo
46 ! { dg-final { cleanup-modules "foo bar" } }