<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Since version 3.8 calling `std::string::insert` with three `int`s is ambiguous"
   href="https://bugs.llvm.org/show_bug.cgi?id=48600">48600</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Since version 3.8 calling `std::string::insert` with three `int`s is ambiguous
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>boris.staletic@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Here's a godbolt link: <a href="https://godbolt.org/z/7K5vhh">https://godbolt.org/z/7K5vhh</a>

Calling `str.insert(0, 1, 0);` is ambiguous because it can be interpreted in
two ways:

1. `insert(size_t pos, size_t count, char value);`
2. `insert(const char*, InputIt, InputIt);`

The first `0` argument does indeed equally match `size_t` and `const char*`,
but `1` shouldn't be matching `InputIt` according to the standard:

<a href="https://eel.is/c++draft/string.insert#21">https://eel.is/c++draft/string.insert#21</a>

However, libc++ relaxes this constraint with
[`__libcpp_string_gets_noexcept_iterator`](<a href="https://github.com/llvm/llvm-project/blob/3696227c10f5e5841223c2a2fb63fdd1d50a7930/libcxx/include/string#L1165-L1170">https://github.com/llvm/llvm-project/blob/3696227c10f5e5841223c2a2fb63fdd1d50a7930/libcxx/include/string#L1165-L1170</a>).

The commit that introduced this relaxation seems to be
<a href="https://github.com/llvm/llvm-project/commit/76b4afc04051298081c2f46056138b4013c2f49d#diff-534bc2907ddb3b074ded1353d18fd7d578daf1707943b3039bab4ed975aba3b3R1594">https://github.com/llvm/llvm-project/commit/76b4afc04051298081c2f46056138b4013c2f49d#diff-534bc2907ddb3b074ded1353d18fd7d578daf1707943b3039bab4ed975aba3b3R1594</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>