[Bug fortran/48786] [OOP] Generic ambiguity check too strict for polymorphic dummies

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Wed Aug 21 12:19:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48786

--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I still get the errors

pr48786_2.f90:132.46:

     generic, public         :: operator(+) => add_vector
                                              1
Error: 'add_vector_3d' and 'add_vector_2d' for GENERIC '+' at (1) are ambiguous
pr48786_2.f90:133.50:

     generic, public         :: assignment(=)   => assign
                                                  1
Error: 'assign_3d' and 'assign_2d' for GENERIC '=' at (1) are ambiguous
pr48786_2.f90:249.6:

  use points2d3d   ! Both 2D and 3D points available
      1
Fatal Error: Can't open module file 'points2d3d.mod' for reading at (1): No
such file or directory

with the test in http://gcc.gnu.org/ml/fortran/2011-04/msg00293.html
at r201817 or 4.8.1.

The errors are gone with the following change

--- pr48786_2.f90    2013-07-01 22:53:35.000000000 +0200
+++ pr48786_2_db.f90    2013-08-21 14:15:35.000000000 +0200
@@ -129,8 +129,8 @@ module points2d3d
      procedure               :: add_vector      => add_vector_3d
      procedure               :: random          => random_vector_3d
      procedure               :: assign          => assign_3d
-     generic, public         :: operator(+) => add_vector
-     generic, public         :: assignment(=)   => assign
+!     generic, public         :: operator(+) => add_vector
+!     generic, public         :: assignment(=)   => assign
   end type point3d

 contains

in type, extends(point2d) :: point3d. Is this a bug or the expected behavior?



More information about the Gcc-bugs mailing list