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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <[email protected]>:

https://gcc.gnu.org/g:524bca2e33b56077b1ffe9e7526857afdbccce16

commit r16-4449-g524bca2e33b56077b1ffe9e7526857afdbccce16
Author: Jonathan Wakely <[email protected]>
Date:   Wed Oct 15 12:52:27 2025 +0100

    libstdc++: Fix missing __to_timeout_timespec for targets using POSIX sleep
[PR122293]

    The preprocessor condition for defining the new __to_timeout_timespec
    function templates did not match all the conditions under which it's
    needed.

    std::this_thread::sleep_for is defined #if ! defined _GLIBCXX_NO_SLEEP
    but it relies on __to_timeout_timespec which was only being defined for
    targets that use nanosleep, or clock_gettime, or use gthreads.

    For a non-gthreads target that uses POSIX sleep to implement
    std::this_thread::sleep_for, the build fails with:

    include/bits/this_thread_sleep.h:71:40: error: '__to_timeout_timespec' is
not a member of 'std::chrono' [-Wtemplate-body]
       71 |         struct timespec __ts =
chrono::__to_timeout_timespec(__rtime);
          |                                        ^~~~~~~~~~~~~~~~~~~~~

    Presumably the same would happen for mingw-w64 if configured with
    --disable-threads (as that would be a non-gthreads target that doesn't
    use nanosleep or clock_gettime).

    libstdc++-v3/ChangeLog:

            PR libstdc++/122293
            * include/bits/chrono.h (__to_timeout_timespec): Fix
            preprocessor condition to match the conditions under which
            callers of this function are defined.
            * include/bits/this_thread_sleep.h: Remove unused include.

Reply via email to