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: unassignedclangb...@nondot.org
Reporter: boris.stale...@gmail.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs