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 10 11 // XFAIL: gcc-7 12 13 // <functional> 14 15 // equal_to, not_equal_to, less, et al. 16 17 // Test that these types can be constructed w/o an initializer in a constexpr 18 // context. This is specifically testing gcc.gnu.org/PR83921 19 20 21 #include <functional> 22 #include "test_macros.h" 23 24 template <class T> 25 constexpr bool test_constexpr_context() { 26 std::equal_to<T> eq; 27 ((void)eq); 28 std::not_equal_to<T> neq; 29 ((void)neq); 30 std::less<T> l; 31 ((void)l); 32 std::less_equal<T> le; 33 ((void)le); 34 std::greater<T> g; 35 ((void)g); 36 std::greater_equal<T> ge; 37 ((void)ge); 38 return true; 39 } 40 41 static_assert(test_constexpr_context<int>(), ""); 42 static_assert(test_constexpr_context<void>(), ""); 43 44 45 int main(int, char**) { 46 47 48 return 0; 49 } 50