This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.
Section: 184.108.40.206 [string.cons] Status: NAD Submitter: Jonathan Wakely Opened: 2016-11-15 Last modified: 2017-02-03
Priority: Not Prioritized
View all other issues in [string.cons].
View all issues with NAD status.
The new constructor added for LWG 2742 causes an ambiguity when attempting to construct from a (non-const) char*
char s = "whoops"; std::string str(s, 2, 4);
This is the same problem discussed in 2758, and the fix is the same: disable that new constructor if T is convertible to const_pointer, so that the old constructor is used instead.
Previous resolution [SUPERSEDED]:
This wording is relative to N4606.
Modify the new basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); constructor in 220.127.116.11 [string.cons] as shown:template<class T> basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator());
-?- Effects: Creates a variable, sv, as if by basic_string_view<charT, traits> sv = t; and then behaves the same as:basic_string(sv.substr(pos, n), a)
-?- Remarks: This constructor shall not participate in overload resolution unless is_convertible_v<const T&, basic_string_view<charT, traits>> is true .
[2016-12-21, Jonathan comments and reommends NAD]
Tim Song pointed out that this constructor isn't ambiguous, and I can no longer reproduce the errors I was getting, so I think this issue should be resolved NAD. The code snippet in the issue discussion compiles OK without the proposed change.