From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id DBC0E3858D37; Mon, 10 Oct 2022 20:38:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBC0E3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665434317; bh=PB+p1ywZFUVk/Wk406u46vYIgg20hwh/l6dpZCMe62w=; h=From:To:Subject:Date:From; b=uOnbCNAc7/1CGEVXzJaF1tZHJtDx7H9GuqJJEP7HT3xlxFWXQXvWr4fNxXh9bEWK5 EqAVCg8QhjiX94cEs+RVqYFkxcm3Fi3S9JvcVRMkPI5GIUKVELuMA4jQUGy3WMed4A CGNVHaKMSISSRFCyhFrNuVCIqvSx0Gzh9Erqt2/M= 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 r13-3203] libstdc++: Revert addition of constraints to make_signed/make_unsigned X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 67efffec943656a509e036cd3c785a5c3d6885e1 X-Git-Newrev: 1d2f07ed4ce028a7c1f9b18f5d959f30213545ca Message-Id: <20221010203837.DBC0E3858D37@sourceware.org> Date: Mon, 10 Oct 2022 20:38:37 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1d2f07ed4ce028a7c1f9b18f5d959f30213545ca commit r13-3203-g1d2f07ed4ce028a7c1f9b18f5d959f30213545ca Author: Jonathan Wakely Date: Mon Oct 10 15:06:53 2022 +0100 libstdc++: Revert addition of constraints to make_signed/make_unsigned Constraining the primary template makes it unusable in uninstantiated contexts. libstdc++-v3/ChangeLog: * include/std/type_traits (make_signed, make_unsigned): Remove constraints on primary template. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Undo changes to expected error in C++20 mode. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/24_iterators/range_access/range_access_cpp20_neg.cc: Likewise. * testsuite/20_util/make_signed/requirements/uninstantiated.cc: New test. * testsuite/20_util/make_unsigned/requirements/uninstantiated.cc: New test. Diff: --- libstdc++-v3/include/std/type_traits | 6 ------ .../testsuite/20_util/make_signed/requirements/typedefs_neg.cc | 3 +-- .../testsuite/20_util/make_signed/requirements/uninstantiated.cc | 8 ++++++++ .../testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc | 3 +-- .../20_util/make_unsigned/requirements/uninstantiated.cc | 8 ++++++++ .../testsuite/24_iterators/range_access/range_access_cpp20_neg.cc | 3 +-- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 6108b98aa6a..1d7c3b04a0e 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1802,9 +1802,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Primary template. /// make_unsigned template -#if __cpp_concepts - requires is_integral<_Tp>::value || __is_enum(_Tp) -#endif struct make_unsigned { typedef typename __make_unsigned_selector<_Tp>::__type type; }; @@ -1937,9 +1934,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Primary template. /// make_signed template -#if __cpp_concepts - requires is_integral<_Tp>::value || __is_enum(_Tp) -#endif struct make_signed { typedef typename __make_signed_selector<_Tp>::__type type; }; diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 88b8ae887ef..451eeb8c92d 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -43,5 +43,4 @@ void test01() using T8 = make_signed::type; // { dg-error "here" } } -// { dg-error "invalid use of incomplete type" "" { target c++17_down } 0 } -// { dg-error "constraint failure" "" { target c++20 } 0 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/uninstantiated.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/uninstantiated.cc new file mode 100644 index 00000000000..3facf0c595a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/uninstantiated.cc @@ -0,0 +1,8 @@ +// { dg-do compile { target c++11 } } +#include + +// Check that we can name invalid specializations, just don't instantiate them. + +using X = std::make_signed; +using Y = std::make_signed; +using Z = std::make_signed; diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 50f15e7037c..49d520936a3 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -43,5 +43,4 @@ void test01() using T8 = make_unsigned::type; // { dg-error "here" } } -// { dg-error "invalid use of incomplete type" "" { target c++17_down } 0 } -// { dg-error "constraint failure" "" { target c++20 } 0 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/uninstantiated.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/uninstantiated.cc new file mode 100644 index 00000000000..9b860967379 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/uninstantiated.cc @@ -0,0 +1,8 @@ +// { dg-do compile { target c++11 } } +#include + +// Check that we can name invalid specializations, just don't instantiate them. + +using X = std::make_unsigned; +using Y = std::make_unsigned; +using Z = std::make_unsigned; diff --git a/libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp20_neg.cc b/libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp20_neg.cc index 26c8ae0ee1e..c0825a58587 100644 --- a/libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp20_neg.cc +++ b/libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp20_neg.cc @@ -46,5 +46,4 @@ test03() C c; std::ssize(c); // { dg-error "no matching function" } } -// { dg-error "incomplete type .*make_signed.*S" "" { target c++17_down } 0 } -// { dg-error "constraint failure" "" { target c++20 } 0 } +// { dg-error "incomplete type .*make_signed.*S" "" { target *-*-* } 0 }