[llvm-bugs] [Bug 48600] New: Since version 3.8 calling `std::string::insert` with three `int`s is ambiguous
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Dec 25 09:44:27 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48600
Bug ID: 48600
Summary: Since version 3.8 calling `std::string::insert` with
three `int`s is ambiguous
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: boris.staletic at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Here's a godbolt link: https://godbolt.org/z/7K5vhh
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:
https://eel.is/c++draft/string.insert#21
However, libc++ relaxes this constraint with
[`__libcpp_string_gets_noexcept_iterator`](https://github.com/llvm/llvm-project/blob/3696227c10f5e5841223c2a2fb63fdd1d50a7930/libcxx/include/string#L1165-L1170).
The commit that introduced this relaxation seems to be
https://github.com/llvm/llvm-project/commit/76b4afc04051298081c2f46056138b4013c2f49d#diff-534bc2907ddb3b074ded1353d18fd7d578daf1707943b3039bab4ed975aba3b3R1594
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201225/95dae65a/attachment-0001.html>
More information about the llvm-bugs
mailing list