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

    <tr>
        <th>Summary</th>
        <td>
            std::multimap::erase has strange/undefined behavior when passed an iterator from a different map
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          DCtheTall
      </td>
    </tr>
</table>

<pre>
    Calling `std::multimap::erase` using an iterator from a different multimap, in some cases, does not cause a crash and can cause some strange/undefined behavior (e.g. it can cause the `size` method to return an incorrect value).

I have a toy [Chromium CL](https://chromium-review.googlesource.com/c/chromium/src/+/4031816) reproducing the behavior.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEUs1u3DwMfBr5QsTQj-3YBx-SXRj4gO_YF-DKXFuFLC1EaYP06Qs72za9pBcJIjnCDGeQ2S2BaBTtq2jPFZa8xjSeT3mlb-h9dYnz-3hC711YQHSS8yzMizAvW_HZbXj7eFFCJtFJKLwPYgCXKWGOCa4pboAwu-uVEoUMv5H6BC4Ax43AIhPvhTkSQ4gZLBYmQLAJeQUMM1gMj-oB4ZwwLCT0VMJMVxdohguteHcxgdA91UsNLn-C5ZUOCe7HQXWjvMYZcoREuaRwsA42pkQ2wx19IaGHWsizkC8f53-w4n1nleM7iPb1tKa4ubLB6X_RnoXu15xvvK9ET0JP9tF-SnR39FYvMS6eOJZkqbZx20c-jQk9cbIH9FXoqZFG9aoTeoBEtxTnYvfd7ip-6ayreTTzYAasaFTds5JN18imWkcpVY-9UZ00_dAO_aXrOyNRWWUGo2RTuVFLrZVWjRqM0U1t7dV0Bq9KyeG5bwbRSNrQ-dr7-1bHtFSOudDYDq1uK48X8nzERutAb3A0hdZ7itK4Y54uZWHRSO84859fssuexq9yBCvy1_a-rRTghsw0_yNreKtK8uPfviwur-XycGAn9riebil-J5uFng45LPR0yP0ZAAD__yo_B9c">