[flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)
[llvm-project.git] / libcxx / test / std / concepts / concepts.lang / concepts.arithmetic / integral.compile.pass.cpp
blob1891b3939d4845c7164d12b453a00f9539e85f53
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // template<class T>
12 // concept integral = // see below
14 #include <concepts>
15 #include <type_traits>
17 #include "arithmetic.h"
18 #include "test_macros.h"
20 template <typename T>
21 constexpr bool CheckIntegralQualifiers() {
22 constexpr bool result = std::integral<T>;
23 static_assert(std::integral<const T> == result);
24 static_assert(std::integral<volatile T> == result);
25 static_assert(std::integral<const volatile T> == result);
27 static_assert(!std::integral<T&>);
28 static_assert(!std::integral<const T&>);
29 static_assert(!std::integral<volatile T&>);
30 static_assert(!std::integral<const volatile T&>);
32 static_assert(!std::integral<T&&>);
33 static_assert(!std::integral<const T&&>);
34 static_assert(!std::integral<volatile T&&>);
35 static_assert(!std::integral<const volatile T&&>);
37 static_assert(!std::integral<T*>);
38 static_assert(!std::integral<const T*>);
39 static_assert(!std::integral<volatile T*>);
40 static_assert(!std::integral<const volatile T*>);
42 static_assert(!std::integral<T (*)()>);
43 static_assert(!std::integral<T (&)()>);
44 static_assert(!std::integral<T (&&)()>);
46 return result;
49 // standard signed and unsigned integers
50 static_assert(CheckIntegralQualifiers<signed char>());
51 static_assert(CheckIntegralQualifiers<unsigned char>());
52 static_assert(CheckIntegralQualifiers<short>());
53 static_assert(CheckIntegralQualifiers<unsigned short>());
54 static_assert(CheckIntegralQualifiers<int>());
55 static_assert(CheckIntegralQualifiers<unsigned int>());
56 static_assert(CheckIntegralQualifiers<long>());
57 static_assert(CheckIntegralQualifiers<unsigned long>());
58 static_assert(CheckIntegralQualifiers<long long>());
59 static_assert(CheckIntegralQualifiers<unsigned long long>());
61 // extended integers
62 #ifndef TEST_HAS_NO_INT128
63 static_assert(CheckIntegralQualifiers<__int128_t>());
64 static_assert(CheckIntegralQualifiers<__uint128_t>());
65 #endif
67 // bool and char types are also integral
68 static_assert(CheckIntegralQualifiers<wchar_t>());
69 static_assert(CheckIntegralQualifiers<bool>());
70 static_assert(CheckIntegralQualifiers<char>());
71 static_assert(CheckIntegralQualifiers<char8_t>());
72 static_assert(CheckIntegralQualifiers<char16_t>());
73 static_assert(CheckIntegralQualifiers<char32_t>());
75 // types that aren't integral
76 static_assert(!std::integral<void>);
77 static_assert(!CheckIntegralQualifiers<float>());
78 static_assert(!CheckIntegralQualifiers<double>());
79 static_assert(!CheckIntegralQualifiers<long double>());
81 static_assert(!CheckIntegralQualifiers<ClassicEnum>());
83 static_assert(!CheckIntegralQualifiers<ScopedEnum>());
85 static_assert(!CheckIntegralQualifiers<EmptyStruct>());
86 static_assert(!CheckIntegralQualifiers<int EmptyStruct::*>());
87 static_assert(!CheckIntegralQualifiers<int (EmptyStruct::*)()>());
89 static_assert(CheckSubsumption(0));
90 static_assert(CheckSubsumption(0U));