1eb5cfb02SEric Fiselier //===----------------------------------------------------------------------===//
2eb5cfb02SEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6eb5cfb02SEric Fiselier //
7eb5cfb02SEric Fiselier //===----------------------------------------------------------------------===//
8eb5cfb02SEric Fiselier //
9*a7f9895cSLouis Dionne // UNSUPPORTED: no-threads
1031cbe0f2SLouis Dionne // UNSUPPORTED: c++03
11eb5cfb02SEric Fiselier 
12eb5cfb02SEric Fiselier // <future>
13eb5cfb02SEric Fiselier 
14eb5cfb02SEric Fiselier // class packaged_task<R(ArgTypes...)>
15eb5cfb02SEric Fiselier // template <class F>
16eb5cfb02SEric Fiselier //   packaged_task(F&& f);
17eb5cfb02SEric Fiselier // These constructors shall not participate in overload resolution if
18eb5cfb02SEric Fiselier //    decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
19eb5cfb02SEric Fiselier 
20eb5cfb02SEric Fiselier #include <future>
21eb5cfb02SEric Fiselier #include <cassert>
22eb5cfb02SEric Fiselier 
23eb5cfb02SEric Fiselier struct A {};
24eb5cfb02SEric Fiselier typedef std::packaged_task<A(int, char)> PT;
25eb5cfb02SEric Fiselier typedef volatile std::packaged_task<A(int, char)> VPT;
26eb5cfb02SEric Fiselier 
27eb5cfb02SEric Fiselier 
main(int,char **)282df59c50SJF Bastien int main(int, char**)
29eb5cfb02SEric Fiselier {
30009259daSEric Fiselier     VPT init{};
314262748eSEric Fiselier     auto const& c_init = init;
324262748eSEric Fiselier     PT p1{init}; // expected-error {{no matching constructor}}
334262748eSEric Fiselier     PT p2{c_init}; // expected-error {{no matching constructor}}
344262748eSEric Fiselier     PT p3{std::move(init)}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
352df59c50SJF Bastien 
362df59c50SJF Bastien   return 0;
37eb5cfb02SEric Fiselier }
38