-
- Downloads
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.
Showing
- libstdc++-v3/include/bits/chrono_io.h 10 additions, 5 deletionslibstdc++-v3/include/bits/chrono_io.h
- libstdc++-v3/include/std/format 15 additions, 15 deletionslibstdc++-v3/include/std/format
- libstdc++-v3/include/std/ostream 1 addition, 1 deletionlibstdc++-v3/include/std/ostream
- libstdc++-v3/include/std/print 1 addition, 1 deletionlibstdc++-v3/include/std/print
- libstdc++-v3/testsuite/20_util/duration/io.cc 2 additions, 1 deletionlibstdc++-v3/testsuite/20_util/duration/io.cc
- libstdc++-v3/testsuite/std/format/arguments/args.cc 20 additions, 6 deletionslibstdc++-v3/testsuite/std/format/arguments/args.cc
- libstdc++-v3/testsuite/std/format/arguments/args_neg.cc 12 additions, 0 deletionslibstdc++-v3/testsuite/std/format/arguments/args_neg.cc
- libstdc++-v3/testsuite/std/format/arguments/lwg3810.cc 6 additions, 2 deletionslibstdc++-v3/testsuite/std/format/arguments/lwg3810.cc
- libstdc++-v3/testsuite/std/format/functions/format.cc 4 additions, 2 deletionslibstdc++-v3/testsuite/std/format/functions/format.cc
- libstdc++-v3/testsuite/std/format/functions/vformat_to.cc 7 additions, 2 deletionslibstdc++-v3/testsuite/std/format/functions/vformat_to.cc
- libstdc++-v3/testsuite/std/format/string.cc 5 additions, 2 deletionslibstdc++-v3/testsuite/std/format/string.cc
- libstdc++-v3/testsuite/std/time/day/io.cc 2 additions, 2 deletionslibstdc++-v3/testsuite/std/time/day/io.cc
- libstdc++-v3/testsuite/std/time/month/io.cc 2 additions, 2 deletionslibstdc++-v3/testsuite/std/time/month/io.cc
- libstdc++-v3/testsuite/std/time/weekday/io.cc 2 additions, 2 deletionslibstdc++-v3/testsuite/std/time/weekday/io.cc
- libstdc++-v3/testsuite/std/time/year/io.cc 2 additions, 2 deletionslibstdc++-v3/testsuite/std/time/year/io.cc
- libstdc++-v3/testsuite/std/time/year_month_day/io.cc 2 additions, 2 deletionslibstdc++-v3/testsuite/std/time/year_month_day/io.cc
Loading
Please register or sign in to comment