From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1984) id A61883A73817; Fri, 17 Jul 2020 13:26:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A61883A73817 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594992402; bh=1IgU955HE92bhOwf6u8YGQFyckchsL1Qfns9MFiQL3E=; h=From:To:Subject:Date:From; b=N55LgYTHuftp7eYXZDoQIu+02aZ7dTfm5iKnPGsbxDRxtCytU62otlNwZc36vgYI+ nGJOe/mv3XdofA/iapgU6AcrPGmL1ztkywjhTEmddjTHQPSsrOn+EqWQmKczHXWnP7 DkPMVS3elAGbIKx314gCDOYv2AhINUZEl1jWs63Y= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tamar Christina To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/arm-perf-staging)] libstdc++: Support N3644 "Null Forward Iterators" for testsuite iterators X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/vendors/ARM/heads/arm-perf-staging X-Git-Oldrev: e431546ff9f1367538ed1307a1c98fa32fec7a8a X-Git-Newrev: e94f2542305ccb5c4a3c4e5e8212713747623417 Message-Id: <20200717132642.A61883A73817@sourceware.org> Date: Fri, 17 Jul 2020 13:26:42 +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: Fri, 17 Jul 2020 13:26:42 -0000 https://gcc.gnu.org/g:e94f2542305ccb5c4a3c4e5e8212713747623417 commit e94f2542305ccb5c4a3c4e5e8212713747623417 Author: Jonathan Wakely Date: Thu Feb 27 13:01:14 2020 +0000 libstdc++: Support N3644 "Null Forward Iterators" for testsuite iterators Comparing value-initialized forward_iterator_wrapper objects fails an assertion, but should be valid in C++14 and later. * testsuite/util/testsuite_iterators.h (forward_iterator_wrapper): Add equality comparisons that support value-initialized iterators. Diff: --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/testsuite/util/testsuite_iterators.h | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0df7126f7c9..946459c3cb8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-02-27 Jonathan Wakely + * testsuite/util/testsuite_iterators.h (forward_iterator_wrapper): Add + equality comparisons that support value-initialized iterators. + * include/bits/boost_concept_check.h (__function_requires): Add _GLIBCXX14_CONSTEXPR. * testsuite/25_algorithms/min/concept_checks.cc: New test. diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h index 7b7093919b7..417dff23c50 100644 --- a/libstdc++-v3/testsuite/util/testsuite_iterators.h +++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h @@ -337,6 +337,26 @@ namespace __gnu_test ++*this; return tmp; } + +#if __cplusplus >= 201402L + bool + operator==(const forward_iterator_wrapper& it) const noexcept + { + // Since C++14 value-initialized forward iterators are comparable. + if (this->SharedInfo == nullptr || it.SharedInfo == nullptr) + return this->SharedInfo == it.SharedInfo && this->ptr == it.ptr; + + const input_iterator_wrapper& base_this = *this; + const input_iterator_wrapper& base_that = it; + return base_this == base_that; + } + + bool + operator!=(const forward_iterator_wrapper& it) const noexcept + { + return !(*this == it); + } +#endif }; /**