| 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, c++11, c++14, c++17, c++20 |
| 11 |
|
| 12 |
// checks that CTAD for std::packaged_task works properly with static operator() overloads |
| 13 |
|
| 14 |
#include <future> |
| 15 |
#include <type_traits> |
| 16 |
|
| 17 |
struct Except { |
| 18 |
static int operator()(int*, long*) { return 0; } |
| 19 |
}; |
| 20 |
static_assert(std::is_same_v<decltype(std::packaged_task{Except{}}), std::packaged_task<int(int*, long*)>>); |
| 21 |
|
| 22 |
struct Noexcept { |
| 23 |
static int operator()(int*, long*) noexcept { return 0; } |
| 24 |
}; |
| 25 |
static_assert(std::is_same_v<decltype(std::packaged_task{Noexcept{}}), std::packaged_task<int(int*, long*)>>); |