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