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: c++03
10 
11 // <functional>
12 
13 // class function<R(ArgTypes...)>
14 
15 // explicit operator bool() const
16 
17 #include <functional>
18 #include <cassert>
19 #include <type_traits>
20 
21 #include "test_macros.h"
22 
g(int)23 int g(int) {return 0;}
24 
main(int,char **)25 int main(int, char**)
26 {
27     static_assert(std::is_constructible<bool, std::function<void()> >::value, "");
28     static_assert(!std::is_convertible<std::function<void()>, bool>::value, "");
29 
30     {
31     std::function<int(int)> f;
32     assert(!f);
33     f = g;
34     assert(f);
35     }
36 
37   return 0;
38 }
39