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

    <tr>
        <th>Summary</th>
        <td>
            Invalid fixit from modernize-use-ranges for binary std::transform
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          chrchr-github
      </td>
    </tr>
</table>

<pre>
    ~~~c++
#include <vector>
#include <algorithm>
#include <ranges>
#include <iostream>

int main() {
 std::vector<int> a = { 1, 2, 3 }, b = { 3, 2, 1 };
 std::ranges::transform(a, b.begin(), a.begin(), [](auto x, auto y) { return x + y; });
    //std::ranges::transform(a, b, a.begin(), [](auto x, auto y) { return x + y; }); // valid
    for (auto i : a)
        std::cout << i << ' ';
}
~~~
~~~
<source>:8:5: warning: use a ranges version of this algorithm [modernize-use-ranges]
    1 | #include <vector>
    2 | #include <algorithm>
    3 | #include <ranges>
    4 | #include <iostream>
    5 | 
    6 | int main() {
    7 |     std::vector<int> a = { 1, 2, 3 }, b = { 3, 2, 1 };
    8 |     std::transform(a.begin(), a.end(), b.begin(), a.begin(), [](auto x, auto y) { return x + y; });
      |     ^~~~~~~~~~~~~~ ~~~~~~~~~  ~~~~~~~
      |     std::ranges::transform a
~~~
https://godbolt.org/z/PE1YhYYh8
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VU1vqzoQ_TXDZpQIbAiwYEG-pLd72y4NGPAT2JVt0qaL_PYnOyRtGu7VXVQXJWTgHHuOx2ccZozoJOcFJFtI9gGbbK90Ufe67vWqE7afqqBSzbm4XC41kK37hCUQKmQ9TA1HoLsTr63SQA9PCBs6pYXtxyVQM9lxs4QIZazm7DYqLIW0ODIhgWRAcoTUiUBjG6Al0PImYCekBXpAhkD3joURkB0Sd6MI6d4F1R2kdzDyIH2c9abPxVYzaVqlRyAZ87OsK97dBLkX7PuLa0Udf7IK3z3HRed5Bai5nbTEdwSyxTPQ7VVhPutARCBHIMc_FPTjIub0eGKDaGZFrdJ4m00g0BKZI19Bd93F1mqybi-B7jzTB0BS972u0CUKy8vlcr8D3Rk16Zq7jadlBrRMXI43pqWQnQsnw5HhtRJ44toIJVG1aHth8G43t-5RNVxL8cFXk-GruXbJftbqdtzp-ZWPHYcscL452tHoAu2rtx0nXuA8utyxkivr-rDxD8vOR8TUww8l_9E2QMTsOcWD7Z5bgMvm8_GvtAjeNUJyuHy98DO6hU9jft9ayO7O7K199bBviU41lRrsWukOyPEDyPHfQ_TSv7z0WdAUtMlpzgJeRCnNNnkcR3HQF9WmzvOIRXWVxXkctXFURwmrSENImm9YGIiChCQJSRhHWRxG8bpq2zyvYr6J0zrhTQhxyEcmhvUwnEaXOxDGTLyISJLGYTCwig_GH-SESP6GHgVC3LmuCzdoVU2dgTgchLHmcxor7MCLf6RvdGzFu7DYajXiUgv5I6ASkunzgi2CSQ_Ft2L5P5F1rUYgR5dz_lm9avUfry2Qo1dqgBznpZwK8n8AAAD__wAB4aQ">