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()18 int main()
19 {
20     int i = 0;
21     std::reference_wrapper ri(i);
22     static_assert(std::is_same_v<decltype(ri), std::reference_wrapper<int>>);
23     std::reference_wrapper ri2(ri);
24     static_assert(std::is_same_v<decltype(ri2), std::reference_wrapper<int>>);
25     const int j = 0;
26     std::reference_wrapper rj(j);
27     static_assert(std::is_same_v<decltype(rj), std::reference_wrapper<const int>>);
28     std::reference_wrapper rj2(rj);
29     static_assert(std::is_same_v<decltype(rj2), std::reference_wrapper<const int>>);
30 }
31