This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Add noexcept to shared_ptr owner comparisons (LWG 2873)
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Christophe Lyon <christophe dot lyon at linaro dot org>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Sep 2017 11:30:55 +0100
- Subject: Re: [PATCH] Add noexcept to shared_ptr owner comparisons (LWG 2873)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C077E83F45
- References: <20170605093423.GA11607@redhat.com> <CAKdteOZaxTZapFum8bupdxcWn2NQdG+q3M4=Z7w6BF_V6_DPQQ@mail.gmail.com>
On 05/09/17 08:30 +0200, Christophe Lyon wrote:
Hi Jonathan
On 5 June 2017 at 11:34, Jonathan Wakely <jwakely@redhat.com> wrote:
C++17 requires these to be noexcept, and there's no reason not to do
it for earlier standard modes too.
* include/bits/shared_ptr_base.h (__shared_ptr::owner_before)
(__weak_ptr::owner_before, _Sp_owner_less::operator()): Add noexcept
specifiers as per LWG 2873 and LWG 2942.
* testsuite/20_util/owner_less/noexcept.cc: New.
* testsuite/20_util/shared_ptr/observers/owner_before.cc: Test
noexcept guarantees.
* testsuite/20_util/weak_ptr/observers/owner_before.cc: Likewise.
Tested powerpc64le-linux, committed to trunk.
I've noticed you have backported this patch to gcc-6-branch (r251673).
The new test testsuite/20_util/owner_less/noexcept.cc fails with:
/libstdc++-v3/testsuite/20_util/owner_less/noexcept.cc:34: error:
aggregate 'const std::owner_less<void> ov' has incomplete type and
cannot be defined
Huh, I fixed that in the gcc-5-branch backport, but not gcc-6-branch.
Fixed by this patch.
commit 3c6ae9c30e86263cf764cef946b8783810583079
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Sep 5 10:31:05 2017 +0100
Remove owner_less<void> test that fails on gcc-6-branch
* testsuite/20_util/owner_less/noexcept.cc: Remove owner_less<void>
tests.
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8a87b7b155a..d88a08f2452 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-05 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/20_util/owner_less/noexcept.cc: Remove owner_less<void>
+ tests.
+
2017-09-04 Jonathan Wakely <jwakely@redhat.com>
Backport from mainline
diff --git a/libstdc++-v3/testsuite/20_util/owner_less/noexcept.cc b/libstdc++-v3/testsuite/20_util/owner_less/noexcept.cc
index 25c9afde8e1..fcf5d4f2679 100644
--- a/libstdc++-v3/testsuite/20_util/owner_less/noexcept.cc
+++ b/libstdc++-v3/testsuite/20_util/owner_less/noexcept.cc
@@ -29,12 +29,3 @@ const std::owner_less<std::weak_ptr<int>> owi;
static_assert( noexcept(owi(wi, wi)), "" );
static_assert( noexcept(owi(si, wi)), "" );
static_assert( noexcept(owi(wi, si)), "" );
-const std::shared_ptr<long> sl;
-const std::weak_ptr<char> wc;
-const std::owner_less<void> ov;
-static_assert( noexcept(ov(si, si)), "" );
-static_assert( noexcept(ov(si, sl)), "" );
-static_assert( noexcept(ov(sl, si)), "" );
-static_assert( noexcept(ov(si, wc)), "" );
-static_assert( noexcept(ov(wc, si)), "" );
-static_assert( noexcept(ov(wc, wi)), "" );