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

           Summary: [OOP] Multiple identical specific procedures in
                    type-bound generic not detected
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
                CC: ja...@gcc.gnu.org


The first code ("module M1") is accepted without any error.
Expected: Diagnose that the generic operator (+) has two ambiguous specific
bindings, one to myadd_t the other to myadd_x.

Ditto for the second code ("M2"), which is also currently accepted.



  module M1
    type T
      integer x
    contains
      procedure :: MyAdd_t => myadd
      generic :: operator(+) => myAdd_t
    end type T
    type X
      real q
    contains
      procedure, pass(b) :: MyAdd_x => myadd
      generic :: operator(+) => myAdd_x
    end type X
  contains
    integer function MyAdd ( A, B )
      class(t), intent(in) :: A
      class(x), intent(in) :: B
      myadd = a%x + b%q
    end function MyAdd
  end module

  module M2
    interface operator(+)
      procedure MyAdd
    end interface
    type T
      integer x
    contains
      procedure :: MyAdd_t => myadd
      generic :: operator(+) => myAdd_t
    end type T
  contains
    integer function MyAdd ( A, B )
      class(t), intent(in) :: A
      real, intent(in) :: B
      myadd = a%x + b
    end function MyAdd
  end module

Reply via email to