aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-01-05 15:16:33 +0000
committerJonathan Wakely <jwakely@redhat.com>2022-01-05 15:31:04 +0000
commit6aa0859afaf28f4fb13121352225bc5877e02a44 (patch)
treea601c01e4b0752a19f48161cfd77a92870934e64 /gcc
parent3633cc54284450433b81f0340483e15df1a49a3c (diff)
downloadgcc-6aa0859afaf28f4fb13121352225bc5877e02a44.zip
gcc-6aa0859afaf28f4fb13121352225bc5877e02a44.tar.gz
gcc-6aa0859afaf28f4fb13121352225bc5877e02a44.tar.bz2
libstdc++: Fix overconstrained std::string constructor [PR103919]
The C++17 basic_string(const T&, size_t, size_t) constructor is overconstrained, so it can't be used for a NTBS and a temporary string gets constructed (potentially allocating memory). There is no corresponding constructor taking an NTBS, so no need to disambiguate from it. Accepting an NTBS avoids the temporary (and potential allocation) and is what the standard requires. libstdc++-v3/ChangeLog: PR libstdc++/103919 * include/bits/basic_string.h (basic_string(const T&, size_t, size_t)): Relax constraints on string_view parameter. * include/bits/cow_string.h (basic_string(const T&, size_t, size_t)): Likewise. * testsuite/21_strings/basic_string/cons/char/103919.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions