https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109162

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <tkami...@gcc.gnu.org>:

https://gcc.gnu.org/g:84d668b0ca67c5d3fe6430f101d61e60aa796a81

commit r15-9198-g84d668b0ca67c5d3fe6430f101d61e60aa796a81
Author: Tomasz KamiÅski <tkami...@redhat.com>
Date:   Thu Apr 3 17:22:39 2025 +0200

    libstdc++: Provide formatter for vector<bool>::reference [PR109162]

    This patch implement formatter for vector<bool>::reference which
    is part of P2286R8.

    To indicate partial support we define __glibcxx_format_ranges macro
    value 1, without defining __cpp_lib_format_ranges.

    To avoid including the whole content of the <format> header, we
    introduce new bits/formatfwd.h forward declares classes required
    for newly introduce formatter.

    The signatures of the user-facing parse and format method of the provided
    formatters deviate from the standard by constraining types of params:
    * _Bit_reference instead T satisfying is-vector-bool-reference<T>
    * _CharT is constrained __formatter::__char
    * basic_format_parse_context<_CharT> for parse argument
    * basic_format_context<_Out, _CharT> for format second argument
    The standard specifies last three of above as unconstrained types, which
leads
    to formattable<vector<bool>::reference, char32_t> (and any other type as
char)
    being true.

            PR libstdc++/109162

    libstdc++-v3/ChangeLog:

            * include/Makefile.am: Add bits/formatfwd.h.
            * include/Makefile.in: Add bits/formatfwd.h.
            * include/bits/version.def: Define __glibcxx_format_ranges without
            corresponding std name.
            * include/bits/version.h: Regenerate.
            * include/std/format (basic_format_context, __format::__char):
            Move declartions to bits/formatfwd.h.
            (formatter<_Tp, _CharT>): Remove default argument for _CharT
            parameter, now specified in forward declaration in
bits/formatfwd.h.
            * include/std/vector (formatter<_Bit_reference, _CharT>): Define.
            * include/bits/formatfwd.h: New file with forward declarations
            for bits of std/format.
            * testsuite/23_containers/vector/bool/format.cc: New test.

    Reviewed-by: Jonathan Wakely <jwak...@redhat.com>
    Signed-off-by: Tomasz KamiÅski <tkami...@redhat.com>

Reply via email to