From patchwork Thu Feb 27 13:03:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1245845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-520241-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=Yue7/DyA; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KMkiheXQ; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48StC9358sz9sP7 for ; Fri, 28 Feb 2020 00:03:31 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=s3s28iVcCSw2/+SJYMTY4F2YI8uZhmDYFpqt+5d964KfsBzYVHWEz of9sK4WwRVxYGPsconh2wxapayi4eLoMbhvYn9FqD+XITg8KTb4bAps76DjvxO8Z MHY6Lsb/hZaWI7x+mYvnipN6K2t8GnsWwMz5uGHEhovAfAXQ/JQ7Mw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=qK7p3ufJFL/fGTjHH+5ijHxNLEM=; b=Yue7/DyAcyolqAPY+RLY cGD5cbDrdtvN5i/8nsReR1VS/XrwGEU/sHAqun+UK8Iev1XyC/M9s0kmgpA4KOEr synE4jtc7WoI6z2sii5R4IXWVAd7Xu5xJn9O2cPrJgIdIK9+vt6kfKtyI7onzAET IgeBose2M/Sq1fiGsjeJmAQ= Received: (qmail 60609 invoked by alias); 27 Feb 2020 13:03:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 60583 invoked by uid 89); 27 Feb 2020 13:03:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Feb 2020 13:03:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582808594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=8Fo/1SCrZr//OeyQGpyRNFKFFXIEpTtBOmMrgm2fnpw=; b=KMkiheXQRwQQUit4Gd199VVr4NlUUqjywdqCF6fCkHQRj+kRnBEHUgQt4pAfnQ1ampMeqv R6oxVLBH8vc2mhxHdP6YQBAJNn83wUs/tj7tixj1nyB8PJ4WsOqN5kpdNM8hoAJZ8xMzD3 XjaMjDPK402f0QOknbSNNYxtql5x94I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-ffeovn0oOY2UgOBsxMHCeA-1; Thu, 27 Feb 2020 08:03:11 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BD8718FF661; Thu, 27 Feb 2020 13:03:10 +0000 (UTC) Received: from localhost (unknown [10.33.36.184]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24F535C651; Thu, 27 Feb 2020 13:03:09 +0000 (UTC) Date: Thu, 27 Feb 2020 13:03:09 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Support N3644 "Null Forward Iterators" for testsuite iterators Message-ID: <20200227130309.GA2514880@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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. Tested powerpc64le-linux, committed to master. 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 --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 }; /**