From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id EA56F3896C12; Mon, 12 Apr 2021 12:31:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA56F3896C12 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-8132] libstdc++: Implement LWG 3404 for C++20 subrange [PR 100044] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 1c35444b919683be23208479312a45e73d23ed35 X-Git-Newrev: 7569ce583f540ae22c585cc5159e3b23deedd987 Message-Id: <20210412123136.EA56F3896C12@sourceware.org> Date: Mon, 12 Apr 2021 12:31:36 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 12:31:37 -0000 https://gcc.gnu.org/g:7569ce583f540ae22c585cc5159e3b23deedd987 commit r11-8132-g7569ce583f540ae22c585cc5159e3b23deedd987 Author: Jonathan Wakely Date: Mon Apr 12 12:49:17 2021 +0100 libstdc++: Implement LWG 3404 for C++20 subrange [PR 100044] These deduction guides became useless with LWG 3282 (implemented in commit r10-6741) and so were removed by LWG 3404. libstdc++-v3/ChangeLog: PR libstdc++/100044 * include/bits/ranges_util.h (__detail::__iterator_sentinel_pair): Remove helper concept. (subrange(_Pr), subrange(Pr, __make_unsigned_like<...>)): Remove deduction guides, as per LWG 3404. * testsuite/std/ranges/subrange/lwg3282_neg.cc: Check that class template argument deduction fails. Diff: --- libstdc++-v3/include/bits/ranges_util.h | 15 --------------- libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc | 13 +++++++++++++ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libstdc++-v3/include/bits/ranges_util.h b/libstdc++-v3/include/bits/ranges_util.h index ae53afd97bd..9d51e1b874e 100644 --- a/libstdc++-v3/include/bits/ranges_util.h +++ b/libstdc++-v3/include/bits/ranges_util.h @@ -186,11 +186,6 @@ namespace ranges && __convertible_to_non_slicing<_Up, tuple_element_t<0, _Tp>> && convertible_to<_Vp, tuple_element_t<1, _Tp>>; - template - concept __iterator_sentinel_pair - = !range<_Tp> && __pair_like<_Tp> - && sentinel_for, tuple_element_t<0, _Tp>>; - } // namespace __detail enum class subrange_kind : bool { unsized, sized }; @@ -352,16 +347,6 @@ namespace ranges __detail::__make_unsigned_like_t>) -> subrange<_It, _Sent, subrange_kind::sized>; - template<__detail::__iterator_sentinel_pair _Pr> - subrange(_Pr) - -> subrange, tuple_element_t<1, _Pr>>; - - template<__detail::__iterator_sentinel_pair _Pr> - subrange(_Pr, __detail::__make_unsigned_like_t>>) - -> subrange, tuple_element_t<1, _Pr>, - subrange_kind::sized>; - template subrange(_Rng&&) -> subrange, sentinel_t<_Rng>, diff --git a/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc b/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc index d9894e4f137..170f4d2962b 100644 --- a/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc +++ b/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc @@ -29,3 +29,16 @@ struct Base {}; struct Derived : Base {}; subrange sd; subrange sb = sd; // { dg-error "conversion" } + +void +test_lwg3404() +{ + // LWG 3404. Finish removing subrange's conversions from pair-like + std::pair p; + subrange sb1(p); // { dg-error "no matching function" } + // { dg-error "class template argument deduction" "" { target *-*-* } 38 } + subrange sb2(p, p.second - p.first); // { dg-error "no matching function" } + // { dg-error "class template argument deduction" "" { target *-*-* } 40 } + + // { dg-prune-output "in requirements with" } +}