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++98, c++03, c++11, c++14, c++17
10 
11 // <functional>
12 //
13 // reference_wrapper<T>
14 //
15 //  where T is an incomplete type (since C++20)
16 
17 
18 #include <functional>
19 #include <cassert>
20 
21 
22 struct Foo;
23 
24 Foo& get_foo();
25 
26 void test() {
27     Foo& foo = get_foo();
28     std::reference_wrapper<Foo> ref{foo};
29     assert(&ref.get() == &foo);
30 }
31 
32 struct Foo { };
33 
34 Foo& get_foo() {
35     static Foo foo;
36     return foo;
37 }
38 
39 int main() {
40     test();
41 }
42