summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/interface_assignment_5.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/interface_assignment_5.f9049
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/interface_assignment_5.f90 b/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
new file mode 100644
index 000000000..8444dd084
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_assignment_5.f90
@@ -0,0 +1,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" } }