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.
Tested powerpc64le-linux, committed to trunk.
commit 9e09c9a4b99b3be725144aeaebe902783a9e70a3
Author: Jonathan Wakely <[email protected]>
Date: Tue Apr 23 10:58:22 2019 +0100
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.
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 <typename _From, typename _To>
template<typename _Tp>
struct unwrap_reference<reference_wrapper<_Tp>> { using type = _Tp&; };
+ template<typename _Tp>
+ using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
+
/// Decay type and if it's a reference_wrapper, unwrap it
template<typename _Tp>
- struct unwrap_ref_decay : unwrap_reference<decay_t<_Tp>> { };
+ struct unwrap_ref_decay { using type = unwrap_reference_t<decay_t<_Tp>>; };
template<typename _Tp>
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<typename T, typename U = T>
{
using std::unwrap_reference;
using T2 = typename unwrap_reference<T>::type;
- static_assert(expect_same<T2, typename unwrap_reference<T2>::type>::value);
+ static_assert(expect_same<T2, std::unwrap_reference_t<T2>>::value);
return expect_same<T2, U>::value;
}