brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 5fd6c96 Raw
56 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// <functional>10 11// UNSUPPORTED: c++03, c++11, c++1412 13// class function<R(ArgTypes...)>14 15// template<class A> function(allocator_arg_t, const A&, function&&);16//17// This signature was removed in C++1718 19#include <functional>20#include <memory>21#include <utility>22 23class A24{25    int data_[10];26public:27    static int count;28 29    A()30    {31        ++count;32        for (int i = 0; i < 10; ++i)33            data_[i] = i;34    }35 36    A(const A&) {++count;}37 38    ~A() {--count;}39 40    int operator()(int i) const41    {42        for (int j = 0; j < 10; ++j)43            i += data_[j];44        return i;45    }46};47 48int A::count = 0;49 50int g(int) { return 0; }51 52void f() {53    std::function<int(int)> f = A();54    std::function<int(int)> f2(std::allocator_arg, std::allocator<A>(), std::move(f)); // expected-error {{no matching constructor for initialization of}}55}56