Issue 124766
Summary [Flang] Incorrect diagnostic on user defined operator of two different types uses the same module procedure
Labels flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code:
```
module m

   type base
      integer :: i = -999
      contains
         procedure, pass(b) :: g => int_base1_base
 generic :: operator(+) => g
   end type

   type base1
      integer :: j  = -999
      contains
         procedure, pass :: f => int_base1_base
         generic :: operator(+) => f
   end type

 contains

   integer function int_base1_base ( a, b )
      class(base1), intent(in) :: a
      class(base), intent(in) :: b
   end function

end module
```

Flang currently issues an error as:
```
error: Semantic errors in t.f
./t.f:7:21: error: Generic 'OPERATOR(+)' may not have specific procedures 'base%g' and 'base1%f' as their interfaces are not distinguishable
           generic :: operator(+) => g
 ^^^^^^^^^^^
./t.f:19:21: Procedure 'g' of type 'base' is bound to 'int_base1_base'
     integer function int_base1_base ( a, b )
 ^^^^^^^^^^^^^^
./t.f:19:21: Procedure 'f' of type 'base1' is bound to 'int_base1_base'
     integer function int_base1_base
```

The code seems conforming to me. There doesn't seem any ambiguity when the user defined (+) is executed.  
Both ifort and XLF compiled it successfully. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to