From 82e8c3da7408bc0695511ee13f88d451c8adadd8 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 23 Apr 2019 11:27:14 +0100 Subject: [PATCH] Corrections for C++2a std::unwrap_reference traits The P0318R1 paper added to the C++2a draft recently was not the latest version of the paper, and should have included these changes. These changes will be made to the working draft via a Defect Report, so I'm applying them to libstdc++ now. * include/std/type_traits (unwrap_reference_t): Define for C++2a. (unwrap_ref_decay): Remove inheritance from unwrap_reference. * testsuite/20_util/unwrap_reference/1.cc: Adjust test to use alias. From-SVN: r270506 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/std/type_traits | 5 ++++- libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e222cb30de9..f04a7e009a5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2019-04-23 Jonathan Wakely + + * include/std/type_traits (unwrap_reference_t): Define for C++2a. + (unwrap_ref_decay): Remove inheritance from unwrap_reference. + * testsuite/20_util/unwrap_reference/1.cc: Adjust test to use alias. + 2019-04-23 Ramana Radhakrishnan Bernd Edlinger Jakub Jelinek diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index c3cb67a457d..e0ac5c88dfc 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -3067,9 +3067,12 @@ template template struct unwrap_reference> { using type = _Tp&; }; + template + using unwrap_reference_t = typename unwrap_reference<_Tp>::type; + /// Decay type and if it's a reference_wrapper, unwrap it template - struct unwrap_ref_decay : unwrap_reference> { }; + struct unwrap_ref_decay { using type = unwrap_reference_t>; }; template using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; diff --git a/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc b/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc index 38feca4bb5b..243526725a0 100644 --- a/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc +++ b/libstdc++-v3/testsuite/20_util/unwrap_reference/1.cc @@ -28,7 +28,7 @@ template { using std::unwrap_reference; using T2 = typename unwrap_reference::type; - static_assert(expect_same::type>::value); + static_assert(expect_same>::value); return expect_same::value; } -- 2.30.2