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
10 // UNSUPPORTED: c++03, c++11, c++14
12 // checks that CTAD works properly
15 #include <type_traits>
18 static_assert(std::is_same_v
<decltype(std::packaged_task
{func
}), std::packaged_task
<int(char*)>>);
20 int funcn(char*) noexcept
;
21 static_assert(std::is_same_v
<decltype(std::packaged_task
{funcn
}), std::packaged_task
<int(char*)>>);
23 template <bool Noexcept
>
25 int operator()(char*) noexcept(Noexcept
);
27 static_assert(std::is_same_v
<decltype(std::packaged_task
{Callable
<true>{}}), std::packaged_task
<int(char*)>>);
28 static_assert(std::is_same_v
<decltype(std::packaged_task
{Callable
<false>{}}), std::packaged_task
<int(char*)>>);
30 template <bool Noexcept
>
32 int operator()(char*) const noexcept(Noexcept
);
34 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableC
<true>{}}), std::packaged_task
<int(char*)>>);
35 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableC
<false>{}}), std::packaged_task
<int(char*)>>);
37 template <bool Noexcept
>
39 int operator()(char*) const noexcept(Noexcept
);
41 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableV
<true>{}}), std::packaged_task
<int(char*)>>);
42 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableV
<false>{}}), std::packaged_task
<int(char*)>>);
44 template <bool Noexcept
>
46 int operator()(char*) const volatile noexcept(Noexcept
);
48 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableCV
<true>{}}), std::packaged_task
<int(char*)>>);
49 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableCV
<false>{}}), std::packaged_task
<int(char*)>>);
51 template <bool Noexcept
>
53 int operator()(char*) & noexcept(Noexcept
);
55 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableL
<true>{}}), std::packaged_task
<int(char*)>>);
56 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableL
<false>{}}), std::packaged_task
<int(char*)>>);
58 template <bool Noexcept
>
60 int operator()(char*) const & noexcept(Noexcept
);
62 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableCL
<true>{}}), std::packaged_task
<int(char*)>>);
63 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableCL
<false>{}}), std::packaged_task
<int(char*)>>);
65 template <bool Noexcept
>
67 int operator()(char*) const noexcept(Noexcept
);
69 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableVL
<true>{}}), std::packaged_task
<int(char*)>>);
70 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableVL
<false>{}}), std::packaged_task
<int(char*)>>);
72 template <bool Noexcept
>
74 int operator()(char*) const volatile & noexcept(Noexcept
);
76 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableCVL
<true>{}}), std::packaged_task
<int(char*)>>);
77 static_assert(std::is_same_v
<decltype(std::packaged_task
{CallableCVL
<false>{}}), std::packaged_task
<int(char*)>>);