view gcc/testsuite/gfortran.dg/interface_assignment_5.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { 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