1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03, c++11
11 
12 // XFAIL: gcc-7, gcc-8
13 
14 // <functional>
15 
16 // equal_to, not_equal_to, less, et al.
17 
18 // Test that these types can be constructed w/o an initializer in a constexpr
19 // context. This is specifically testing gcc.gnu.org/PR83921
20 
21 
22 #include <functional>
23 #include "test_macros.h"
24 
25 template <class T>
test_constexpr_context()26 constexpr bool test_constexpr_context() {
27   std::equal_to<T> eq;
28   ((void)eq);
29   std::not_equal_to<T> neq;
30   ((void)neq);
31   std::less<T> l;
32   ((void)l);
33   std::less_equal<T> le;
34   ((void)le);
35   std::greater<T> g;
36   ((void)g);
37   std::greater_equal<T> ge;
38   ((void)ge);
39   return true;
40 }
41 
42 static_assert(test_constexpr_context<int>(), "");
43 static_assert(test_constexpr_context<void>(), "");
44 
45 
main()46 int main() {
47 
48 }
49