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 // UNSUPPORTED: c++03, c++11, c++14 10 // UNSUPPORTED: libcpp-no-deduction-guides 11 12 // <functional> 13 14 // template <class T> 15 // reference_wrapper(T&) -> reference_wrapper<T>; 16 17 #include <functional> 18 main()19int main() 20 { 21 int i = 0; 22 std::reference_wrapper ri(i); 23 static_assert(std::is_same_v<decltype(ri), std::reference_wrapper<int>>); 24 std::reference_wrapper ri2(ri); 25 static_assert(std::is_same_v<decltype(ri2), std::reference_wrapper<int>>); 26 const int j = 0; 27 std::reference_wrapper rj(j); 28 static_assert(std::is_same_v<decltype(rj), std::reference_wrapper<const int>>); 29 std::reference_wrapper rj2(rj); 30 static_assert(std::is_same_v<decltype(rj2), std::reference_wrapper<const int>>); 31 } 32