diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-01-07 22:21:08 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-01-08 01:14:50 +0000 |
commit | 2a8ee2592e48735d88df786cbafa6b0da39fc4d6 (patch) | |
tree | 109224a93e20515d720ae141e87744d512e90fb2 /gcc | |
parent | 37a4c5c23a270cd9350ba5d56e526371424b5742 (diff) | |
download | gcc-2a8ee2592e48735d88df786cbafa6b0da39fc4d6.zip gcc-2a8ee2592e48735d88df786cbafa6b0da39fc4d6.tar.gz gcc-2a8ee2592e48735d88df786cbafa6b0da39fc4d6.tar.bz2 |
libstdc++: Implement P2905R2 "Runtime format strings" for C++20
This change makes std::make_format_args refuse to create dangling
references to temporaries. This makes the std::vformat API safer. This
was approved in Kona 2023 as a DR for C++20 so the change is implemented
unconditionally.
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (__formatter_chrono): Always use
lvalue arguments to make_format_args.
* include/std/format (make_format_args): Change parameter pack
from forwarding references to lvalue references. Remove use of
remove_reference_t which is now unnecessary.
(format_to, formatted_size): Remove incorrect forwarding of
arguments.
* include/std/ostream (print): Remove forwarding of arguments.
* include/std/print (print): Likewise.
* testsuite/20_util/duration/io.cc: Use lvalues as arguments to
make_format_args.
* testsuite/std/format/arguments/args.cc: Likewise.
* testsuite/std/format/arguments/lwg3810.cc: Likewise.
* testsuite/std/format/functions/format.cc: Likewise.
* testsuite/std/format/functions/vformat_to.cc: Likewise.
* testsuite/std/format/string.cc: Likewise.
* testsuite/std/time/day/io.cc: Likewise.
* testsuite/std/time/month/io.cc: Likewise.
* testsuite/std/time/weekday/io.cc: Likewise.
* testsuite/std/time/year/io.cc: Likewise.
* testsuite/std/time/year_month_day/io.cc: Likewise.
* testsuite/std/format/arguments/args_neg.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions