[Bug libstdc++/103726] --disable-hosted-libstdcxx (freestanding C++) does not provide <coroutine> as what standard requires

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 11 13:29:39 GMT 2022


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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:265d3e1a4e3d6c71d354f859302f023dc2d33f62

commit r12-6474-g265d3e1a4e3d6c71d354f859302f023dc2d33f62
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jan 10 20:48:53 2022 +0000

    libstdc++: Install <coroutine> header for freestanding [PR103726]

    The standard says that <coroutine> should be present for freestanding.
    That was intentionally left out of the initial implementation, but can
    be done without much trouble. The header should be moved to libsupc++ at
    some point in stage 1.

    The standard also says that <coroutine> defines a std::hash
    specialization, which was missing from our implementation. That's a
    problem for freestanding (see LWG 3653) so only do that for hosted.

    We can use concepts to constrain the __coroutine_traits_impl base class
    when compiled with concepts enabled. In a pure C++20 implementation we
    would not need that base class at all and could just use a constrained
    partial specialization of coroutine_traits. But the absence of the
    __coroutine_traits_impl<R, void> base would create an ABI difference
    between the non-standard C++14/C++17 support for coroutines and the same
    code compiled as C++20. If we drop support for <coroutine> pre-C++20 we
    should revisit this.

    libstdc++-v3/ChangeLog:

            PR libstdc++/103726
            * include/Makefile.am: Install <coroutine> for freestanding.
            * include/Makefile.in: Regenerate.
            * include/std/coroutine: Adjust headers and preprocessor
            conditions.
            (__coroutine_traits_impl): Use concepts when available.
            [_GLIBCXX_HOSTED] (hash<coroutine_handle>): Define.


More information about the Gcc-bugs mailing list