<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/124777>124777</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Incorrect diagnostic on generic type-bound procedure expansion.
        </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
 contains
         procedure, pass :: add3
         procedure :: adde
 generic :: operator(+) => add3
   end type

   interface operator(+)
 module procedure adde
   end interface

   contains

   type(base) elemental function adde (a,b)
      class(base), intent(in) :: a, b
   end function

   type(base) function add3 (a,b)
      class(base), intent(in) :: a, b(:,:,:)
   end function

end module

program genericOperatorResolve007a
   use m

   type(base) :: b0
   type(base), allocatable :: b3(:,:,:)

   b0 = b0 + b3 !! ERROR not expected

end program
```

Flang currently issues an error as:
```
error: Semantic errors in t.f
./t.f:33:4: error: No intrinsic or user-defined ASSIGNMENT(=) matches scalar TYPE(base) and rank 3 array of TYPE(base)
     b0 = b0 + b3
     ^^^^^^^^^^^^
```

It seems the generic interface expansion of `adde` is the culprit as the code passed after I removed it.
All ifort , gfortran and XLF compile the code successfully.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU1v4zYQ_TX0ZRCDouxIPuigOHERoM0WyR7a44gcyWwpUiCpdP3vC0ryB5INemkgRCI5H28e34wxBN1ZooptH9j2cYVjPDpfPaLVZPb7I9lV49Sp2jsbtCIP8UjQOmPcP9p2IJ0ilteM1-yeLw-ve6dGQ9CnbV4DQDwNBA0GmpcAoG2kjjzotCOdjahtuJwCwOCdJDV6YmIPA4YAKU9eAyqV_9TwxmDK05Elr-V52w3kMTrPRMnEAxM7YPkjy59uApJVE9QL7oTStyjps3cyWOq8IjinnkNdvC_xbgq9EsNE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