From patchwork Mon Feb 24 23:26:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1243696 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-520037-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=lR1mrYR2; 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=LKwAUrTD; 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 48RJBW0SFpz9sQt for ; Tue, 25 Feb 2020 10:27:30 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=qzmcCJb+dZBJ83H89zg7ONR8vfF7cTbjz8dxoD6uYJbIJgoL3pVii r7eZEhYfq9S7pdYwRCPUIb/lvmEYeJhsms0AXouBkjG7uWKdH6p9B4GemapJ0pMU nEIRXwjLm+yeiDEaCKwQZ+3HVH+HAU0SflveTt88UZgzbvBeb1PqtA= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=3wtocU6wcqpk5qGFbWEWDltes5c=; b=lR1mrYR2NxNlvWbqOkja8ge1RJT6 eCC9HoWj1j/mrAuzzAyL47+Ts3InYZV2b5EUysh9FDWNUDMmLzHzcph9w5wyXgwb 9bzcIMfI0t/xIgY/sKBcNDUpIrb3swcISYxZTUyuCTRUWPjLdhN8hm3ya+so/mxX 2Kipi8Apxaemy0k= Received: (qmail 113640 invoked by alias); 24 Feb 2020 23:27:00 -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 113522 invoked by uid 89); 24 Feb 2020 23:27:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 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=HX-Languages-Length:1785 X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Feb 2020 23:26:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582586817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V9o5/xCyMjtch1fHRU6D6IbCjrvR6Xpg2QtHU3A/js4=; b=LKwAUrTD9HNX6bgPrdDrQwr104HHZmkrCiWu1x/btI16dbhdNX//8mvMgw0O4nJO8D/bAF j6kmjYBOiNb1m50XlEapx7gFXG9zrckmsDFKz9+NqA4LQ14BycvNjLGwGaug/3AeayeNSl su9UCfV+gMmgmLu+Gxs/gORHlUoWbls= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-un6bNa9WNTadIWf34owIKQ-1; Mon, 24 Feb 2020 18:26:55 -0500 Received: by mail-qv1-f70.google.com with SMTP id v3so10772338qvm.2 for ; Mon, 24 Feb 2020 15:26:55 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id p126sm6547463qkd.108.2020.02.24.15.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 15:26:54 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, jwakely@redhat.com, Patrick Palka Subject: [PATCH] libstdc++: LWG 3397 basic_istream_view::iterator should not provide iterator_category Date: Mon, 24 Feb 2020 18:26:43 -0500 Message-Id: <20200224232643.851356-5-ppalka@redhat.com> In-Reply-To: <20200224232643.851356-1-ppalka@redhat.com> References: <20200224232643.851356-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes libstdc++-v3/ChangeLog: LWG 3397 basic_istream_view::iterator should not provide iterator_category * include/std/ranges (basic_istream_view:_Iterator::iterator_category): Rename to ... (basic_istream_view:_Iterator::iterator_concept): ... this. * testsuite/std/ranges/istream_view.cc: Augment test. --- libstdc++-v3/include/std/ranges | 2 +- .../testsuite/std/ranges/istream_view.cc | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 442d1d08098..a7f4da957ef 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -971,7 +971,7 @@ namespace views struct _Iterator { public: - using iterator_category = input_iterator_tag; + using iterator_concept = input_iterator_tag; using difference_type = ptrdiff_t; using value_type = _Val; diff --git a/libstdc++-v3/testsuite/std/ranges/istream_view.cc b/libstdc++-v3/testsuite/std/ranges/istream_view.cc index 1729459bce3..f74e05e347a 100644 --- a/libstdc++-v3/testsuite/std/ranges/istream_view.cc +++ b/libstdc++-v3/testsuite/std/ranges/istream_view.cc @@ -68,10 +68,26 @@ test03() VERIFY( ranges::equal(v, (int[]){0,1,2,3,4}) ); } +template +concept has_iterator_category = requires { typename T::iterator_category; }; + +void +test04() +{ + std::istringstream s("12345"); + auto v = ranges::istream_view(s); + // LWG 3397 + using It = ranges::iterator_t; + static_assert(!has_iterator_category); + static_assert(std::input_iterator); + static_assert(!std::forward_iterator); +} + int main() { test01(); test02(); test03(); + test04(); }