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: no-threads
10// UNSUPPORTED: c++03
11
12// <future>
13
14// class packaged_task<R(ArgTypes...)>
15// template <class F>
16// packaged_task(F&& f);
17// These constructors shall not participate in overload resolution if
18// decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
19
20#include <future>
21#include <cassert>
22
23struct A {};
24typedef std::packaged_task<A(int, char)> PT;
25typedef volatile std::packaged_task<A(int, char)> VPT;
26
27
28int main(int, char**)
29{
30 VPT init{};
31 auto const& c_init = init;
32 PT p1{init}; // expected-error {{no matching constructor}}
33 PT p2{c_init}; // expected-error {{no matching constructor}}
34 PT p3{std::move(init)}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
35
36 return 0;
37}
38

source code of libcxx/test/std/thread/futures/futures.task/futures.task.members/ctor1.verify.cpp