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 11 // <future> 12 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...)>. 18 19 #include <cassert> 20 #include <future> 21 22 #include "test_allocator.h" 23 24 struct A {}; 25 using PT = std::packaged_task<A(int, char)>; 26 using VPT = volatile std::packaged_task<A(int, char)>; 27 28 static_assert(!std::is_constructible<PT, std::allocator_arg_t, test_allocator<A>, VPT>::value, ""); 29 30 using PA = std::packaged_task<A(int)>; 31 using PI = std::packaged_task<int(int)>; 32 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, ""); 37 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, ""); 42