brintos

brintos / llvm-project-archived public Read only

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