From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id 34109386F039; Fri, 28 Aug 2020 19:57:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34109386F039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598644658; bh=Sk9Xke+RcKheeAPwV/nicfvIJVJE2q1i8g/zEikr/hc=; h=From:To:Subject:Date:From; b=pdRXKpYT0vPQ7zQ7k2WP0uLAf8mr6nlaF9xGrNaAIDX9DX39bm8HiJ83WHeRDC5hN rip3FKgQZWDcdwNFr2ltgsSqm22MyQUoawhCryQoUbOsHxFFycNfr7X0vES371Dtqt czgW+4R5X3ybdu53tJp12CyqbdG6Hv/flu9hZEco= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: William Schmidt To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins3)] libstdc++: Add deduction guide for std::ranges::join_view [LWG 3474] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/users/wschmidt/heads/builtins3 X-Git-Oldrev: 186aa6304570e15065f31482e9c27326a3a6679f X-Git-Newrev: ef275d1f2083f8a1fa1b59a3cd07fd3e8431023e Message-Id: <20200828195738.34109386F039@sourceware.org> Date: Fri, 28 Aug 2020 19:57:38 +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, 28 Aug 2020 19:57:38 -0000 https://gcc.gnu.org/g:ef275d1f2083f8a1fa1b59a3cd07fd3e8431023e commit ef275d1f2083f8a1fa1b59a3cd07fd3e8431023e Author: Jonathan Wakely Date: Mon Aug 24 16:18:32 2020 +0100 libstdc++: Add deduction guide for std::ranges::join_view [LWG 3474] This implements the proposed resolution for LWG 3474. libstdc++-v3/ChangeLog: * include/std/ranges (join_view): Add deduction guide (LWG 3474). * testsuite/std/ranges/adaptors/join_lwg3474.cc: New test. Diff: --- libstdc++-v3/include/std/ranges | 5 +++ .../testsuite/std/ranges/adaptors/join_lwg3474.cc | 37 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 22184006c08..9d22b138082 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -2693,6 +2693,11 @@ namespace views template explicit join_view(_Range&&) -> join_view>; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3474. Nesting join_views is broken because of CTAD + template + explicit join_view(join_view<_View>) -> join_view>; + namespace views { inline constexpr __adaptor::_RangeAdaptorClosure join diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/join_lwg3474.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/join_lwg3474.cc new file mode 100644 index 00000000000..516aaba7070 --- /dev/null +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/join_lwg3474.cc @@ -0,0 +1,37 @@ +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include +#include + +void +test01() +{ + // LWG 3474. Nesting join_views is broken because of CTAD + std::vector>> nested_vectors = { + {{1, 2, 3}, {4, 5}, {6}}, + {{7}, {8, 9}, {10, 11, 12}}, + {{13}} + }; + auto joined = nested_vectors | std::views::join | std::views::join; + + using V = decltype(joined); + static_assert( std::same_as, int> ); +}