aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-07-09 12:12:56 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-07-31 17:07:10 +0100
commit3836df7e895beda1f159620bfd20024136fda9f0 (patch)
treec3dc06bb1f742271868e578986f25d91ad741b30 /gcc
parent72cd15b20a887bed9b0b1f4196be99fe052247b4 (diff)
downloadgcc-3836df7e895beda1f159620bfd20024136fda9f0.zip
gcc-3836df7e895beda1f159620bfd20024136fda9f0.tar.gz
gcc-3836df7e895beda1f159620bfd20024136fda9f0.tar.bz2
libstdc++: Implement C++26 type checking for std::format args [PR115776]
Implement the changes from P2757R3, which enhance the parse context to be able to do type checking on format arguments, and to use that to ensure that args used for width and precisions are integral types. libstdc++-v3/ChangeLog: PR libstdc++/115776 * include/bits/version.def (format): Update for C++26. * include/bits/version.h: Regenerate. * include/std/format (basic_format_parse_context): Remove default argument from constructor and split into two constructors. Make the constructor taking size_t private for C++26 and later. (basic_format_parse_context::check_dynamic_spec): New member function template. (basic_format_parse_context::check_dynamic_spec_integral): New member function. (basic_format_parse_context::check_dynamic_spec_string): Likewise. (__format::_Spec::_S_parse_width_or_precision): Use check_dynamic_spec_integral. (__format::__to_arg_t_enum): New helper function. (basic_format_arg): Declare __to_arg_t_enum as friend. (__format::_Scanner): Define and use a derived parse context type. (__format::_Checking_scanner): Make arg types available to parse context. * testsuite/std/format/functions/format.cc: Check for new values of __cpp_lib_format macro. * testsuite/std/format/parse_ctx.cc: Check all members of basic_format_parse_context. * testsuite/std/format/parse_ctx_neg.cc: New test. * testsuite/std/format/string.cc: Add more checks for dynamic width and precision args.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions