From patchwork Thu Mar 5 16:24:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1249710 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-520721-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=GbbhWlfI; 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=P00LgRoK; 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 48YGL83TW3z9sPK for ; Fri, 6 Mar 2020 03:24:45 +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:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=xkVQAioRJmnCXqhO tmf9ZvQB1xzm/kqmYZs8z8NgewxckqQNft9L4OgKtgAAIb3alx/IF9FuHHSTwBiv whh4lNh9gCZkdxzNRCaxentCG6gxYHPXqNbSrgr2sXhjp112NO3iOCufmNjnThCr hwZw8DQgMtnMUo/k3Prp0St6Nlw= 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:mime-version:content-type :content-transfer-encoding; s=default; bh=yj2yW/dM7BHFH1GIDA1u5t IH/UI=; b=GbbhWlfIWH+S6b1KO+8kESQHDZ+R9pXftvqUiiv/pnpANbZsgO4Eth c6OKukJy6tLyG8lLJVa0nkpyLM3e1lEsGM5S3aXib4uJFYud6/p+lhW2WhwxTvq8 aACGLy8Y44VHjfHddE9Nym6/dIMrQo5reWJh2iSTuKotlxrf3RSBk= Received: (qmail 93517 invoked by alias); 5 Mar 2020 16:24:37 -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 81399 invoked by uid 89); 5 Mar 2020 16:24:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 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:2100 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Mar 2020 16:24:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583425456; 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; bh=CoG/9hhOyEbpZyTaygEbD5n7fAP450NkeGby5woCjMc=; b=P00LgRoKyTSUcA34tBj03nqxd02GRDWGfazbFPnwjG+5zvX/E/dcYxW6oxmFBApAoogoQw 8UY9tqg2XDhi+Jv8forUo3p9DxcslcTaHIDszomE6hYb7Z96v2vkhiOwfyQ+vKrpfA7xVR mB7Q87fJ4FXzvXgbr3TdcahPFIkJAwY= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-uGykMKvNOCOpyPkgfk5yGw-1; Thu, 05 Mar 2020 11:24:12 -0500 Received: by mail-qv1-f71.google.com with SMTP id l16so3243753qvo.15 for ; Thu, 05 Mar 2020 08:24:12 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id a18sm14852896qkg.48.2020.03.05.08.24.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 08:24:11 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH 2/1] libstdc++: Add missing friend declaration to join_view::_Sentinel Date: Thu, 5 Mar 2020 11:24:09 -0500 Message-Id: <20200305162409.2723743-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes The converting constructor of join_view::_Sentinel needs to be able to access the private members of join_view::_Sentinel. libstdc++-v3/ChangeLog: * include/std/ranges (join_view::_Sentinel<_Const>): Befriend join_view::_Sentinel. * testsuite/std/ranges/adaptors/join.cc: Augment test. --- libstdc++-v3/include/std/ranges | 2 ++ .../testsuite/std/ranges/adaptors/join.cc | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 57edc895e3d..16195812b70 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -2593,6 +2593,8 @@ namespace views friend constexpr bool operator==(const _Iterator<_Const>& __x, const _Sentinel& __y) { return __y.__equal(__x); } + + friend _Sentinel; }; _Vp _M_base = _Vp(); diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc index d3e652da009..142c9feddcd 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc @@ -101,6 +101,28 @@ test05() VERIFY( i == v.end() ); } +void +test06() +{ + std::vector x = {""}; + auto i = std::counted_iterator(x.begin(), 1); + auto r = ranges::subrange{i, std::default_sentinel}; + auto v = r | views::transform(std::identity{}) | views::join; + + // Verify that _Iterator is implicitly convertible to _Iterator. + static_assert(!std::same_as); + auto a = ranges::cbegin(v); + a = ranges::begin(v); + + // Verify that _Sentinel is implicitly convertible to _Sentinel. + static_assert(!ranges::common_range); + static_assert(!std::same_as); + auto b = ranges::cend(v); + b = ranges::end(v); +} + int main() { @@ -109,4 +131,5 @@ main() test03(); test04(); test05(); + test06(); }