<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124766>124766</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Incorrect diagnostic on user defined operator of two different types uses the same module procedure
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU2P2zYQ_TXUZRBBoizLOuig_XBRoECCdA-9BRQ5lBhQpEFSu_W_L0hZ3s3upkmKGgJsj2aG7828GTLv1WgQO1LfkPouY0uYrOvumFGob28nNNlgxbm7tcYrgQ7ChCCt1vZJmRG4FUiqnhQ92ReXp-hnKxaNMEdz0QNAOJ8QBuZx_QsAygQc0UEMrnpQQKo7-NC27dWDWxOYMv5qAICTsxzF4pDQWzgx7wk9DIS2W5oxpiHVfUz_JZ5XftlOHdGgU3zztCd0LFhH6IHQmzVFihzX89CIhPothfJ7HL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