This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/49591] New: [OOP] Multiple identical specific procedures in type-bound generic not detected


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: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]