public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48786] New: [OOP] Generic ambiguity check too strict for polymorphic dummies
@ 2011-04-27  7:40 burnus at gcc dot gnu.org
  2011-04-27 14:34 ` [Bug fortran/48786] [4.6/4.7 Regression][OOP] " burnus at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-27  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [OOP] Generic ambiguity check too strict for
                    polymorphic dummies
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@gcc.gnu.org


Created attachment 24110
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24110
Example program

Reported at c.l.f by Arjen Markus
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/4a4e885f68b660bd

I have not really thought about the issue, but I believe gfortran wrongly
rejects the program.


One has:
  type point2d
with
  generic, public :: operator(+) => add_vector
and
  type, extends(point2d) :: point3d
with
  generic, public :: operator(+) => add_vector_3dversion

As one can pass any "point3d" data type to either add_vector_3dversion or
add_vector, gfortran complains:
  Error: 'add_vector_3d' and 'add_vector_2d' for GENERIC '+' at (1) are
ambiguous

However, the TKI is different, and thus I believe the error message is wrong -
in calls, add_vector_3d should be preferred and only if not available, one
should fall back to add_vector_2d.

"A dummy argument is type, kind, and rank compatible, or TKR compatible, with
another dummy argument if the first is type compatible with the second, the
kind type parameters of the first have the same values as the corresponding
kind type parameters of the second, and both have the same rank." (F2008,
12.4.3.4.5)

-> I believe the arguments have a different (declared) type.

It should also be somewhat compatible with: "12.5.5.2 Resolving procedure
references to names established to be generic" - but there it does not tell
which function one should call. Admittedly, I am a bit lost.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-01-24 17:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27  7:40 [Bug fortran/48786] New: [OOP] Generic ambiguity check too strict for polymorphic dummies burnus at gcc dot gnu.org
2011-04-27 14:34 ` [Bug fortran/48786] [4.6/4.7 Regression][OOP] " burnus at gcc dot gnu.org
2011-04-28  8:07 ` burnus at gcc dot gnu.org
2011-04-29  9:27 ` burnus at gcc dot gnu.org
2011-04-29 14:02 ` jakub at gcc dot gnu.org
2011-04-29 16:13 ` burnus at gcc dot gnu.org
2011-04-30 10:11 ` burnus at gcc dot gnu.org
2011-05-11 13:58 ` burnus at gcc dot gnu.org
2011-05-11 15:22 ` [Bug fortran/48786] [OOP] " burnus at gcc dot gnu.org
2013-07-02  9:13 ` dominiq at lps dot ens.fr
2013-08-21  8:48 ` janus at gcc dot gnu.org
2013-08-21 10:25 ` janus at gcc dot gnu.org
2013-08-21 12:19 ` dominiq at lps dot ens.fr
2013-08-21 14:43 ` janus at gcc dot gnu.org
2013-08-21 14:48 ` janus at gcc dot gnu.org
2021-01-24 17:55 ` tkoenig at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).