//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // UNSUPPORTED: no-threads // // class packaged_task // template // packaged_task(allocator_arg_t, const Allocator& a, F&& f); // These constructors shall not participate in overload resolution if // decay::type is the same type as std::packaged_task. #include #include #include #include #include "test_allocator.h" struct A {}; using PT = std::packaged_task; using VPT = volatile std::packaged_task; static_assert(!std::is_constructible, VPT>::value, ""); using PA = std::packaged_task; using PI = std::packaged_task; static_assert(!std::is_constructible, const PA&>::value, ""); static_assert(!std::is_constructible, const PA&&>::value, ""); static_assert(!std::is_constructible, volatile PA&>::value, ""); static_assert(!std::is_constructible, volatile PA&&>::value, ""); #if TEST_STD_VER >= 17 // packaged_task allocator support was removed in C++17 (LWG 2921) static_assert(!std::is_constructible_v, const PI&>); static_assert(!std::is_constructible_v, const PI&&>); static_assert(!std::is_constructible_v, volatile PI&>); static_assert(!std::is_constructible_v, volatile PI&&>); #else static_assert(std::is_constructible, const PI&>::value, ""); static_assert(std::is_constructible, const PI&&>::value, ""); static_assert(std::is_constructible, volatile PI&>::value, ""); static_assert(std::is_constructible, volatile PI&&>::value, ""); #endif