summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
blob: 8444dd0847ebb53dbf77c6bcc3e9b026d82f86de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
! { dg-do compile }
!
! PR 42677: [4.5 Regression] Bogus Error: Ambiguous interfaces '...' in intrinsic assignment operator
!
! Contributed by Harald Anlauf <anlauf@gmx.de>

module mod1
  implicit none
  type t_m
     integer :: i = 0
  end type t_m
!------------------------------------------------------------------------------
  interface assignment (=)
     module procedure assign_m
  end interface
!------------------------------------------------------------------------------
contains
  subroutine assign_m (y, x)
    type(t_m) ,intent(inout) :: y
    type(t_m) ,intent(in)    :: x
  end subroutine assign_m
end module mod1
!==============================================================================
module mod2
  use mod1, only: t_m, assignment(=)
  implicit none
  type t_atm
     integer :: k
  end type t_atm
!------------------------------------------------------------------------------
  interface assignment(=)
     module procedure assign_to_atm
  end interface
!------------------------------------------------------------------------------
  interface
     pure subroutine delete_m (x)
       use mod1
       type(t_m) ,intent(in) :: x
     end subroutine delete_m
  end interface
!------------------------------------------------------------------------------
contains
  subroutine assign_to_atm (atm, r)
    type(t_atm) ,intent(inout) :: atm
    integer     ,intent(in)    :: r
  end subroutine assign_to_atm
end module mod2
 
! { dg-final { cleanup-modules "mod1 mod2" } }