In the current implementation of GENERIC type-bound procedures the check if two specific targets of a GENERIC binding could be ambiguous (see standard 16.2.3 Restrictions on generic declarations) is not conformant with this section as it does not handle passed-objects at the moment. The following code is accepted: MODULE m TYPE t CONTAINS PROCEDURE, PASS :: proc1 PROCEDURE, NOPASS :: proc2 GENERIC :: gen => proc1, proc2 END TYPE t CONTAINS SUBROUTINE proc1 (me) IMPLICIT NONE TYPE(t) :: me END SUBROUTINE proc1 SUBROUTINE proc2 () IMPLICIT NONE END SUBROUTINE proc2 END MODULE m PROGRAM main USE m IMPLICIT NONE TYPE(t) :: myobj CALL myobj%gen () END PROGRAM main While the CALL in the main-program would fit to both specific targets.
Note: The test case in comment #0 is (correctly) rejected with PROCEDURE, PASS :: proc1 1 Error: Non-polymorphic passed-object dummy argument of 'proc1' at (1) However, when correcting this, it is still accepted: MODULE m IMPLICIT NONE TYPE t CONTAINS PROCEDURE, PASS :: proc1 PROCEDURE, NOPASS :: proc2 GENERIC :: gen => proc1, proc2 END TYPE CONTAINS SUBROUTINE proc1 (me) CLASS(t) :: me END SUBROUTINE SUBROUTINE proc2 () END SUBROUTINE END MODULE PROGRAM main USE m IMPLICIT NONE TYPE(t) :: myobj CALL myobj%gen () END PROGRAM main This is the same issue as the one reported in PR47710. *** This bug has been marked as a duplicate of bug 47710 ***