25 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++1410 11// <functional>12//13// Make sure we can't initialize a std::function using an allocator (http://wg21.link/p0302r1).14// These constructors were removed in C++17.15 16#include <functional>17#include <memory>18 19struct S : public std::function<void()> { using function::function; };20 21void f() {22 S f1( [](){} );23 S f2(std::allocator_arg, std::allocator<int>{}, f1); // expected-error {{no matching constructor for initialization of 'S'}}24}25