xref: /llvm-project/libcxx/test/std/utilities/function.objects/operations.implicit_ctad.pass.cpp (revision f98a3dd7a23ca1a85f62b38a2a7e82a53f80070b)
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, c++11, c++14
10 
11 // <functional>
12 
13 // Make sure that we can use CTAD with operations in <functional>
14 
15 #include <functional>
16 
17 #include "test_macros.h"
18 
main(int,char **)19 int main(int, char**) {
20     {
21         std::plus f;
22         ASSERT_SAME_TYPE(decltype(f), std::plus<>);
23     }
24     {
25         std::minus f;
26         ASSERT_SAME_TYPE(decltype(f), std::minus<>);
27     }
28     {
29         std::multiplies f;
30         ASSERT_SAME_TYPE(decltype(f), std::multiplies<>);
31     }
32     {
33         std::divides f;
34         ASSERT_SAME_TYPE(decltype(f), std::divides<>);
35     }
36     {
37         std::modulus f;
38         ASSERT_SAME_TYPE(decltype(f), std::modulus<>);
39     }
40     {
41         std::negate f;
42         ASSERT_SAME_TYPE(decltype(f), std::negate<>);
43     }
44     {
45         std::bit_and f;
46         ASSERT_SAME_TYPE(decltype(f), std::bit_and<>);
47     }
48     {
49         std::bit_not f;
50         ASSERT_SAME_TYPE(decltype(f), std::bit_not<>);
51     }
52     {
53         std::bit_or f;
54         ASSERT_SAME_TYPE(decltype(f), std::bit_or<>);
55     }
56     {
57         std::bit_xor f;
58         ASSERT_SAME_TYPE(decltype(f), std::bit_xor<>);
59     }
60     {
61         std::equal_to f;
62         ASSERT_SAME_TYPE(decltype(f), std::equal_to<>);
63     }
64     {
65         std::not_equal_to f;
66         ASSERT_SAME_TYPE(decltype(f), std::not_equal_to<>);
67     }
68     {
69         std::less f;
70         ASSERT_SAME_TYPE(decltype(f), std::less<>);
71     }
72     {
73         std::less_equal f;
74         ASSERT_SAME_TYPE(decltype(f), std::less_equal<>);
75     }
76     {
77         std::greater_equal f;
78         ASSERT_SAME_TYPE(decltype(f), std::greater_equal<>);
79     }
80     {
81         std::greater f;
82         ASSERT_SAME_TYPE(decltype(f), std::greater<>);
83     }
84     {
85         std::logical_and f;
86         ASSERT_SAME_TYPE(decltype(f), std::logical_and<>);
87     }
88     {
89         std::logical_not f;
90         ASSERT_SAME_TYPE(decltype(f), std::logical_not<>);
91     }
92     {
93         std::logical_or f;
94         ASSERT_SAME_TYPE(decltype(f), std::logical_or<>);
95     }
96 
97     return 0;
98 }
99