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

--- Comment #2 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:74605294950e4a49627fb71fdedefea176f5ecf7

commit r16-137-g74605294950e4a49627fb71fdedefea176f5ecf7
Author: Tomasz KamiÅski <tkami...@redhat.com>
Date:   Thu Apr 24 09:32:24 2025 +0200

    libstdc++: Constrain formatter for thread::id [PR119918]

    This patch add constraint __formatter::__char to _CharT type parameter
    of formatter<thread::id, _CharT> specialization, matching the constraint
    of formatting of integer/pointers that are used as native handles.

    The dependency on <format> header, is changed to <bits/formatfwd.h>.
    To achieve that, formatting of pointers is extracted from void const*
    specialization to internal __formatter_ptr<_CharT>, that can be forward
    declared.

    Finally, the handle representation is now printed directly to __fc.out(),
    by the formatter for handle type. To support this, internal formatters
    can now be constructed from _Spec object as alternative to invoking parse
    method.

            PR libstdc++/119918

    libstdc++-v3/ChangeLog:

            * include/bits/formatfwd.h (__format::_Align): Moved from
std/format.
            (std::__throw_format_error, __format::__formatter_str)
            (__format::__formatter_ptr): Declare.
            * include/std/format (__format::_Align): Moved to bits/formatfwd.h.
            (__formatter_int::__formatter_int): Define.
            (__format::__formatter_ptr): Extracted from formatter for const
void*.
            (std::formatter<const void*, _CharT>, formatter<void*, _CharT>)
            (std::formatter<nullptr_t, _CharT>): Delegate to
__formatter_ptr<_CharT>.
            * include/std/thread (std::formatter<thread::id, _CharT>):
Constrain
            _CharT template parameter.
            (formatter<thread::id, _CharT>::parse): Specify default aligment,
and
            qualify __throw_format_error to disable ADL.
            (formatter<thread::id, _CharT>::format): Use formatters to write
directly
            to output.
            * testsuite/30_threads/thread/id/output.cc: Tests for formatting
thread::id
            representing not-a-thread with padding and formattable concept.

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

Reply via email to