aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/version
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-03-22 11:54:31 +0000
committerJonathan Wakely <jwakely@redhat.com>2023-03-22 17:48:20 +0000
commitba4f5530c475eadd2a7edb46b6c1c9d5f9267501 (patch)
tree54b92cfef4f51a49eeeb4dbb505d4a3fcc56f1dc /libstdc++-v3/include/std/version
parent7d4f4ce6a5dcefc5c97a8d05461653cbf536b745 (diff)
downloadgcc-ba4f5530c475eadd2a7edb46b6c1c9d5f9267501.zip
gcc-ba4f5530c475eadd2a7edb46b6c1c9d5f9267501.tar.gz
gcc-ba4f5530c475eadd2a7edb46b6c1c9d5f9267501.tar.bz2
libstdc++: Use rvalues in std::string::resize_and_overwrite (LWG 3645)
Previously the C++23 draft required that the callback arguments were lvalues, which was overvable by the callback. LWG 3645 removes that overspecification, so we can pass rvalues and the user can't modify our local variables. I've used auto(p) to produce rvalues, which is only supported since Clang 15, but I think that's OK for a C++23 feature. While making this change I noticed that we weren't correctly enforcing the requirement that the callback returns an integer-like type. Add better assertions for the type and value. libstdc++-v3/ChangeLog: * include/bits/basic_string.tcc (basic_string::resize_and_overwrite): Pass rvalues to the callback, as now allowed by LWG 3645. Enforce preconditions on the return value. * testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc: Adjust.
Diffstat (limited to 'libstdc++-v3/include/std/version')
0 files changed, 0 insertions, 0 deletions