From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1984) id 31C3A398D04D; Fri, 17 Jul 2020 13:10:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31C3A398D04D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594991455; bh=SbuNotIiQ2HTnD1knOoFZvN+teM6Vof4nG9em9jsgkc=; h=From:To:Subject:Date:From; b=fQJH3bKsMaNWr6Mbjh6eDGhF7gsajONng3tEt6cSO3romDOdsNnr5vTMAIr1L8hqm rhHkgKBEBnnXGadpXsSs7yagnwjk1+L6lZ6kLCCFtfetJBVm5NKOcsHshQDs8kR/1U 7M6CyLrUcyO1pIdC1WkNBxlimJNRNC7tMAbH88ns= 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++: P2116R0 Remove tuple-like protocol support from fixed-extent span X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/vendors/ARM/heads/arm-perf-staging X-Git-Oldrev: aa667c3f36d6a78e1b38e7a9a26899fd385bfcb7 X-Git-Newrev: f5b4dc38852f755de9c48cb78a773ab4e84b8078 Message-Id: <20200717131055.31C3A398D04D@sourceware.org> Date: Fri, 17 Jul 2020 13:10:55 +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:10:55 -0000 https://gcc.gnu.org/g:f5b4dc38852f755de9c48cb78a773ab4e84b8078 commit f5b4dc38852f755de9c48cb78a773ab4e84b8078 Author: Jonathan Wakely Date: Tue Feb 18 12:29:29 2020 +0000 libstdc++: P2116R0 Remove tuple-like protocol support from fixed-extent span Following this change it's no longer possible to use std::span with structured bindings or with the tuple-like API. It will probably come back for C++23 though. P2116R0 Remove tuple-like protocol support from fixed-extent span * include/std/span (get, tuple_size, tuple_element): Remove. * testsuite/23_containers/span/everything.cc: Remove checks for tuple-like API. * testsuite/23_containers/span/get_neg.cc: Remove. * testsuite/23_containers/span/tuple_element_dynamic_neg.cc: Remove. * testsuite/23_containers/span/tuple_element_oob_neg.cc: Remove. * testsuite/23_containers/span/tuple_size_neg.cc: Remove. Diff: --- libstdc++-v3/ChangeLog | 11 ++++++++ libstdc++-v3/include/std/span | 30 ---------------------- .../testsuite/23_containers/span/everything.cc | 4 --- .../testsuite/23_containers/span/get_neg.cc | 30 ---------------------- .../span/tuple_element_dynamic_neg.cc | 25 ------------------ .../23_containers/span/tuple_element_oob_neg.cc | 25 ------------------ .../testsuite/23_containers/span/tuple_size_neg.cc | 25 ------------------ 7 files changed, 11 insertions(+), 139 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ea53bb7269f..75346953416 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2020-02-18 Jonathan Wakely + + P2116R0 Remove tuple-like protocol support from fixed-extent span + * include/std/span (get, tuple_size, tuple_element): Remove. + * testsuite/23_containers/span/everything.cc: Remove checks for + tuple-like API. + * testsuite/23_containers/span/get_neg.cc: Remove. + * testsuite/23_containers/span/tuple_element_dynamic_neg.cc: Remove. + * testsuite/23_containers/span/tuple_element_oob_neg.cc: Remove. + * testsuite/23_containers/span/tuple_size_neg.cc: Remove. + 2020-02-17 Patrick Palka P2106R0 Alternative wording for GB315 and GB316 diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span index 0072010dea8..b8d5e0797a2 100644 --- a/libstdc++-v3/include/std/span +++ b/libstdc++-v3/include/std/span @@ -440,36 +440,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return {reinterpret_cast(__sp.data()), __sp.size_bytes()}; } - // tuple helpers - template - constexpr _Type& - get(span<_Type, _Extent> __sp) noexcept - { - static_assert(_Extent != dynamic_extent && _Index < _Extent, - "get can only be used with a span of non-dynamic (fixed) extent"); - return __sp[_Index]; - } - - template struct tuple_size; - template struct tuple_element; - - template - struct tuple_size> - : public integral_constant - { - static_assert(_Extent != dynamic_extent, "tuple_size can only " - "be used with a span of non-dynamic (fixed) extent"); - }; - - template - struct tuple_element<_Index, span<_Type, _Extent>> - { - static_assert(_Extent != dynamic_extent, "tuple_element can only " - "be used with a span of non-dynamic (fixed) extent"); - static_assert(_Index < _Extent, "Index is less than Extent"); - using type = _Type; - }; - namespace ranges { template extern inline const bool enable_safe_range; diff --git a/libstdc++-v3/testsuite/23_containers/span/everything.cc b/libstdc++-v3/testsuite/23_containers/span/everything.cc index c2f00683ff8..0cca06fa4fe 100644 --- a/libstdc++-v3/testsuite/23_containers/span/everything.cc +++ b/libstdc++-v3/testsuite/23_containers/span/everything.cc @@ -104,8 +104,6 @@ main() static_assert(data_span_first.size() == 3); static_assert(data_span_first.front() == 0); static_assert(data_span_first.back() == 2); - static_assert(std::tuple_size_v == 3); - static_assert(std::is_same_v, const int>); constexpr auto data_span_first_dyn = data_span.first(4); static_assert( @@ -122,8 +120,6 @@ main() static_assert(data_span_last.size() == 5); static_assert(data_span_last.front() == 4); static_assert(data_span_last.back() == 8); - static_assert(std::tuple_size_v == 5); - static_assert(std::is_same_v, const int>); constexpr auto data_span_last_dyn = data_span.last(6); static_assert( diff --git a/libstdc++-v3/testsuite/23_containers/span/get_neg.cc b/libstdc++-v3/testsuite/23_containers/span/get_neg.cc deleted file mode 100644 index 65ff412e252..00000000000 --- a/libstdc++-v3/testsuite/23_containers/span/get_neg.cc +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2019-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=c++2a" } -// { dg-do compile { target c++2a } } - -#include -#include - -int -main() -{ - std::span myspan((int*)nullptr, (std::size_t)0); - std::get<0>(myspan); // { dg-error "here" } -} -// { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/span/tuple_element_dynamic_neg.cc b/libstdc++-v3/testsuite/23_containers/span/tuple_element_dynamic_neg.cc deleted file mode 100644 index b96d88839f6..00000000000 --- a/libstdc++-v3/testsuite/23_containers/span/tuple_element_dynamic_neg.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019-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=c++2a" } -// { dg-do compile { target c++2a } } - -#include -#include - -std::tuple_element<0, std::span> ts; // { dg-error "here" } -// { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/span/tuple_element_oob_neg.cc b/libstdc++-v3/testsuite/23_containers/span/tuple_element_oob_neg.cc deleted file mode 100644 index e9627abff33..00000000000 --- a/libstdc++-v3/testsuite/23_containers/span/tuple_element_oob_neg.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019-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=c++2a" } -// { dg-do compile { target c++2a } } - -#include -#include - -std::tuple_element<3, std::span> te; // { dg-error "here" } -// { dg-error "static assertion failed" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/span/tuple_size_neg.cc b/libstdc++-v3/testsuite/23_containers/span/tuple_size_neg.cc deleted file mode 100644 index 16294738dda..00000000000 --- a/libstdc++-v3/testsuite/23_containers/span/tuple_size_neg.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019-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=c++2a" } -// { dg-do compile { target c++2a } } - -#include -#include - -std::tuple_size> ts; // { dg-error "here" } -// { dg-error "static assertion failed" "" { target *-*-* } 0 }