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 #ifndef LIBCXX_TEST_CONCEPTS_LANG_CONCEPTS_ARITHMETIC_H_ 9 #define LIBCXX_TEST_CONCEPTS_LANG_CONCEPTS_ARITHMETIC_H_ 10 11 #include <concepts> 12 13 // This overload should never be called. It exists solely to force subsumption. 14 template <std::integral I> 15 [[nodiscard]] constexpr bool CheckSubsumption(I) { 16 return false; 17 } 18 19 // clang-format off 20 template <std::integral I> 21 requires std::signed_integral<I> && (!std::unsigned_integral<I>) 22 [[nodiscard]] constexpr bool CheckSubsumption(I) { 23 return std::is_signed_v<I>; 24 } 25 26 template <std::integral I> 27 requires std::unsigned_integral<I> && (!std::signed_integral<I>) 28 [[nodiscard]] constexpr bool CheckSubsumption(I) { 29 return std::is_unsigned_v<I>; 30 } 31 // clang-format on 32 33 enum ClassicEnum { a, b, c }; 34 enum class ScopedEnum { x, y, z }; 35 struct EmptyStruct {}; 36 37 #endif // LIBCXX_TEST_CONCEPTS_LANG_CONCEPTS_ARITHMETIC_H_ 38