From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id 26A283890413; Wed, 17 Jun 2020 19:45:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26A283890413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592423107; bh=65hbe1jU+Kx2nrG+l4xo/NJUBUpHWTQD6NKQ5A5nIPg=; h=From:To:Subject:Date:From; b=UQpgHEkVGUtQ/EUSwp31gKM0+ihbdCy+aOAfX3dCM2jf+B9FYxXOyDWG3+RDXgstu VHzq752/8NDosW6pRGSek4Cz8GJ2arH34tR9wiid1t49PocbFS/KzfTQetj3ltyNog zQWmqM8ChfKtU9+0rfnCg4gBZEWAEulJDsCmyBsQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/ranger] libstdc++ Fix compilation of with Clang X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/devel/ranger X-Git-Oldrev: 07522ae90b5bae2ca95b64f3a4de60bea0cc0567 X-Git-Newrev: e5de406f9967ef4b0bbdbcbc0320869d2bf04558 Message-Id: <20200617194507.26A283890413@sourceware.org> Date: Wed, 17 Jun 2020 19:45:07 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 19:45:07 -0000 https://gcc.gnu.org/g:e5de406f9967ef4b0bbdbcbc0320869d2bf04558 commit e5de406f9967ef4b0bbdbcbc0320869d2bf04558 Author: Jonathan Wakely Date: Wed Mar 18 12:55:29 2020 +0000 libstdc++ Fix compilation of with Clang Clang 9 supports C++20 via -std=c++2a but doesn't support three-way comparisons, so fails to compile. When the compiler doesn't support default comparisons, this patch defines operator== and operator!= for the _Stop_state_ref class. That is enough for the header to be compiled with Clang. It allows operator== for stop_token and stop_source to work, but not operator!= because that isn't explicitly defined. * include/std/stop_token (stop_token::_Stop_state_ref): Define comparison operators explicitly if the compiler won't synthesize them. Diff: --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/include/std/stop_token | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ae5fedbc66b..a9cd2599243 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-03-18 Jonathan Wakely + * include/std/stop_token (stop_token::_Stop_state_ref): Define + comparison operators explicitly if the compiler won't synthesize them. + * include/bits/stl_algobase.h (__lexicographical_compare_aux): Check __cpp_lib_concepts before using iter_reference_t. * include/bits/stream_iterator.h (istream_iterator): Check diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token index 6fb8ae05197..87beb08c71d 100644 --- a/libstdc++-v3/include/std/stop_token +++ b/libstdc++-v3/include/std/stop_token @@ -456,8 +456,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Stop_state_t* operator->() const noexcept { return _M_ptr; } +#if __cpp_impl_three_way_comparison >= 201907L friend bool operator==(const _Stop_state_ref&, const _Stop_state_ref&) = default; +#else + friend bool + operator==(const _Stop_state_ref& __lhs, const _Stop_state_ref& __rhs) + noexcept + { return __lhs._M_ptr == __rhs._M_ptr; } + + friend bool + operator!=(const _Stop_state_ref& __lhs, const _Stop_state_ref& __rhs) + noexcept + { return __lhs._M_ptr != __rhs._M_ptr; } +#endif private: _Stop_state_t* _M_ptr = nullptr;