brintos

brintos / llvm-project-archived public Read only

0
0
Text · 945 B · d0438a9 Raw
39 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710 11// <functional>12//13// reference_wrapper14//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 24struct Foo;25Foo& get_foo();26 27void test() {28    std::reference_wrapper<Foo> ref = get_foo();29    ref(0); // incomplete at the point of call30}31 32struct Foo { void operator()(int) const { } };33Foo& get_foo() { static Foo foo; return foo; }34 35int main(int, char**) {36    test();37    return 0;38}39