brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · de2f539 Raw
39 lines · c
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#ifndef LIBCXX_TEST_CONCEPTS_LANG_CONCEPTS_ARITHMETIC_H_10#define LIBCXX_TEST_CONCEPTS_LANG_CONCEPTS_ARITHMETIC_H_11 12#include <concepts>13 14// This overload should never be called. It exists solely to force subsumption.15template <std::integral I>16constexpr bool CheckSubsumption(I) {17  return false;18}19 20// clang-format off21template <std::integral I>22requires std::signed_integral<I> && (!std::unsigned_integral<I>)23constexpr bool CheckSubsumption(I) {24  return std::is_signed_v<I>;25}26 27template <std::integral I>28requires std::unsigned_integral<I> && (!std::signed_integral<I>)29constexpr bool CheckSubsumption(I) {30  return std::is_unsigned_v<I>;31}32// clang-format on33 34enum ClassicEnum { a, b, c };35enum class ScopedEnum { x, y, z };36struct EmptyStruct {};37 38#endif // LIBCXX_TEST_CONCEPTS_LANG_CONCEPTS_ARITHMETIC_H_39