https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86116

            Bug ID: 86116
           Summary: Ambiguous generic interface not recognised
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mscfd at gmx dot net
  Target Milestone: ---

The following module should not compile. Calling sub(z) with z declared as
"type(t), allocatable :: z" shows the ambiguity.
Replacing "type(t) :: x" by "integer :: x" in the definition of s1 gives the
expected error "Ambiguous interfaces in generic interface 'sub' for ‘s1’ at (1)
and ‘s2’ at (2)".

module mod

private
public sub

   type, public :: t
   end type t

   interface sub
      module procedure s1
      module procedure s2
   end interface sub

contains

   subroutine s1(x)
      type(t) :: x
      ! with integer, gfortran recognises the ambiguity
!      integer :: x
   end subroutine s1

   subroutine s2(x)
      class(*), allocatable :: x
   end subroutine s2

end module mod

Reply via email to