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
This commit is contained in:
Jonathan Wakely 2019-04-23 11:27:14 +01:00 committed by Jonathan Wakely
parent 6e27100979
commit 82e8c3da74
3 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2019-04-23 Jonathan Wakely <jwakely@redhat.com>
* 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 <ramana.radhakrishnan@arm.com>
Bernd Edlinger <bernd.edlinger@hotmail.de>
Jakub Jelinek <jakub@redhat.com>

View File

@ -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;

View File

@ -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;
}