1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 // struct unwrap_ref_decay;
15 // using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type;
17 // UNSUPPORTED: c++03, c++11, c++14, c++17
20 #include <type_traits>
22 #include "test_macros.h"
25 template <typename T
, typename Result
>
27 static_assert(std::is_same_v
<typename
std::unwrap_ref_decay
<T
>::type
, Result
>);
28 static_assert(std::is_same_v
<typename
std::unwrap_ref_decay
<T
>::type
, std::unwrap_ref_decay_t
<T
>>);
33 int main(int, char**) {
39 check
<T
const*, T
const*>();
41 check
<T
const [3], T
const*>();
42 check
<T (), T (*)()>();
43 check
<T (int) const, T (int) const>();
44 check
<T (int) &, T (int) &>();
45 check
<T (int) &&, T (int) &&>();
47 check
<std::reference_wrapper
<T
>, T
&>();
48 check
<std::reference_wrapper
<T
>&, T
&>();
49 check
<std::reference_wrapper
<T
const>, T
const&>();
50 check
<std::reference_wrapper
<T
const>&, T
const&>();
51 check
<std::reference_wrapper
<T
*>, T
*&>();
52 check
<std::reference_wrapper
<T
*>&, T
*&>();
53 check
<std::reference_wrapper
<T
const*>, T
const*&>();
54 check
<std::reference_wrapper
<T
const*>&, T
const*&>();
55 check
<std::reference_wrapper
<T
[3]>, T (&)[3]>();
56 check
<std::reference_wrapper
<T
[3]>&, T (&)[3]>();
57 check
<std::reference_wrapper
<T ()>, T (&)()>();
58 check
<std::reference_wrapper
<T ()>&, T (&)()>();