OSDN Git Service

gcc/fortran:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / used_types_8.f90
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.
7 !
8 ! Contributed by HJ Lu  <hjl@lucon.org>
9 !
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
30
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" } }