1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
13 // class packaged_task<R(ArgTypes...)>
14 // template <class F, class Allocator>
15 // packaged_task(allocator_arg_t, const Allocator& a, F&& f);
16 // These constructors shall not participate in overload resolution if
17 // decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
22 #include "test_allocator.h"
25 using PT
= std::packaged_task
<A(int, char)>;
26 using VPT
= volatile std::packaged_task
<A(int, char)>;
28 static_assert(!std::is_constructible
<PT
, std::allocator_arg_t
, test_allocator
<A
>, VPT
>::value
, "");
30 using PA
= std::packaged_task
<A(int)>;
31 using PI
= std::packaged_task
<int(int)>;
33 static_assert(!std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, const PA
&>::value
, "");
34 static_assert(!std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, const PA
&&>::value
, "");
35 static_assert(!std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, volatile PA
&>::value
, "");
36 static_assert(!std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, volatile PA
&&>::value
, "");
38 static_assert( std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, const PI
&>::value
, "");
39 static_assert( std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, const PI
&&>::value
, "");
40 static_assert( std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, volatile PI
&>::value
, "");
41 static_assert( std::is_constructible
<PA
, std::allocator_arg_t
, std::allocator
<A
>, volatile PI
&&>::value
, "");