1 //===----------------------------------------------------------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <functional> 10 // 11 // template <class T> 12 // struct unwrap_reference; 13 // 14 // template <class T> 15 // using unwrap_reference_t = typename unwrap_reference<T>::type; 16 17 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 18 19 #include <functional> 20 #include <type_traits> 21 22 23 template <typename T, typename Expected> 24 void check_equal() { 25 static_assert(std::is_same_v<typename std::unwrap_reference<T>::type, Expected>); 26 static_assert(std::is_same_v<typename std::unwrap_reference<T>::type, std::unwrap_reference_t<T>>); 27 } 28 29 template <typename T> 30 void check() { 31 check_equal<T, T>(); 32 check_equal<T&, T&>(); 33 check_equal<T const, T const>(); 34 check_equal<T const&, T const&>(); 35 36 check_equal<std::reference_wrapper<T>, T&>(); 37 check_equal<std::reference_wrapper<T const>, T const&>(); 38 } 39 40 struct T { }; 41 42 int main() { 43 check<T>(); 44 check<int>(); 45 check<float>(); 46 47 check<T*>(); 48 check<int*>(); 49 check<float*>(); 50 } 51