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, 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 #include "test_macros.h" 22 23 24 struct Foo; 25 26 Foo& get_foo(); 27 test()28void test() { 29 Foo& foo = get_foo(); 30 std::reference_wrapper<Foo> ref{foo}; 31 assert(&ref.get() == &foo); 32 } 33 34 struct Foo { }; 35 get_foo()36Foo& get_foo() { 37 static Foo foo; 38 return foo; 39 } 40 main(int,char **)41int main(int, char**) { 42 test(); 43 return 0; 44 } 45