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
14 //
15 // template <class... ArgTypes>
16 // std::invoke_result_t<T&, ArgTypes...>
17 // operator()(ArgTypes&&... args) const;
18 //
19 // Requires T to be a complete type (since C++20).
20
21 #include <functional>
22
23
24 struct Foo;
25 Foo& get_foo();
26
test()27 void test() {
28 std::reference_wrapper<Foo> ref = get_foo();
29 ref(0); // incomplete at the point of call
30 }
31
operator ()Foo32 struct Foo { void operator()(int) const { } };
get_foo()33 Foo& get_foo() { static Foo foo; return foo; }
34
main(int,char **)35 int main(int, char**) {
36 test();
37 return 0;
38 }
39