re PR fortran/54195 ([OOP] IMPORT fails with GENERIC TBP: "is already present in...
authorMikael Morin <mikael@gcc.gnu.org>
Mon, 4 Feb 2013 19:06:06 +0000 (19:06 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Mon, 4 Feb 2013 19:06:06 +0000 (19:06 +0000)
fortran/
PR fortran/54195
* resolve.c (resolve_typebound_procedures): Recurse through
resolve_symbol.

testsuite/
PR fortran/54195
* gfortran.dg/typebound_operator_19.f90: New test.
* gfortran.dg/typebound_assignment_4.f90: New test.

From-SVN: r195730

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/typebound_assignment_4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/typebound_operator_19.f90 [new file with mode: 0644]

index bde2d1c6f3b413bef44f04f5fb111dfd8b9bbe0f..50d7538f9c3f4a9f354140b3947dc902c2a83ac4 100644 (file)
@@ -1,3 +1,9 @@
+2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/54195
+       * resolve.c (resolve_typebound_procedures): Recurse through
+       resolve_symbol.
+
 2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/54107
index 5083a5d04ddc401d601ef50e0e0964ddd4a6ab5a..1bb18c97a8bcf064c257a06f38622897f00881f7 100644 (file)
@@ -12344,7 +12344,7 @@ resolve_typebound_procedures (gfc_symbol* derived)
 
   super_type = gfc_get_derived_super_type (derived);
   if (super_type)
-    resolve_typebound_procedures (super_type);
+    resolve_symbol (super_type);
 
   resolve_bindings_derived = derived;
   resolve_bindings_result = SUCCESS;
index 8f407555dcbc632beadc4c7f776269cd73bd1519..156fa38358cafdb322eeb17996605dbe6b2b78f2 100644 (file)
@@ -1,3 +1,9 @@
+2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/54195
+       * gfortran.dg/typebound_operator_19.f90: New test.
+       * gfortran.dg/typebound_assignment_4.f90: New test.
+
 2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/54107
diff --git a/gcc/testsuite/gfortran.dg/typebound_assignment_4.f90 b/gcc/testsuite/gfortran.dg/typebound_assignment_4.f90
new file mode 100644 (file)
index 0000000..56f3b6e
--- /dev/null
@@ -0,0 +1,35 @@
+! { dg-do compile }
+!
+! PR fortran/54195
+! The compiler used to diagnose a duplicate entity in the assignment interface
+! because NC was resolved twice.
+!
+! Contributed by Andrew Benson <abenson@obs.carnegiescience.edu>
+
+module gn
+
+  implicit none
+
+  type :: nc
+   contains
+     procedure :: assign => nca
+     generic   :: assignment(=) => assign
+  end type
+
+  type, extends(nc) :: ncb
+   contains
+     procedure , nopass :: tis => bf
+  end type
+
+contains
+
+  subroutine nca(to,from)
+    class(nc), intent(out) :: to
+    type(nc), intent(in) :: from
+  end subroutine
+
+  logical function bf()
+    bf=.false.
+  end function
+
+end module
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_19.f90 b/gcc/testsuite/gfortran.dg/typebound_operator_19.f90
new file mode 100644 (file)
index 0000000..cf09379
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR fortran/54195
+! The compiler used to diagnose a duplicate entity in the assignment interface
+! because NC was resolved twice.
+!
+! Contributed by Damian Rouson <damian@rouson.net>
+
+module import_clashes_with_generic
+
+  type ,abstract :: foo
+  contains
+    procedure :: unary
+    generic :: operator(-) => unary
+  end type
+
+  abstract interface
+    integer function bar()
+      import :: foo
+    end function
+  end interface
+
+contains
+
+  integer function unary(rhs)
+    class(foo) ,intent(in) :: rhs
+  end function
+
+end module