[clang] [libc++][NFC] Refactor `clang/test/SemaCXX/type-traits.cpp` to use modern `static_assert` (PR #77584)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 03:18:28 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Amirreza Ashouri (AMP999)
<details>
<summary>Changes</summary>
---
Patch is 188.49 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/77584.diff
1 Files Affected:
- (modified) clang/test/SemaCXX/type-traits.cpp (+1672-1683)
``````````diff
diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp
index c5d196a2590f8d..a0ba0f781e0d0d 100644
--- a/clang/test/SemaCXX/type-traits.cpp
+++ b/clang/test/SemaCXX/type-traits.cpp
@@ -3,8 +3,6 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++17 -fblocks -Wno-deprecated-builtins -Wno-defaulted-function-deleted %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++20 -fblocks -Wno-deprecated-builtins -Wno-defaulted-function-deleted %s
-#define T(b) (b) ? 1 : -1
-#define F(b) (b) ? -1 : 1
struct NonPOD { NonPOD(int); };
typedef NonPOD NonPODAr[10];
@@ -214,56 +212,56 @@ struct HasVirtBase : virtual ACompleteType {};
void is_pod()
{
- { int arr[T(__is_pod(int))]; }
- { int arr[T(__is_pod(Enum))]; }
- { int arr[T(__is_pod(POD))]; }
- { int arr[T(__is_pod(Int))]; }
- { int arr[T(__is_pod(IntAr))]; }
- { int arr[T(__is_pod(Statics))]; }
- { int arr[T(__is_pod(Empty))]; }
- { int arr[T(__is_pod(EmptyUnion))]; }
- { int arr[T(__is_pod(Union))]; }
- { int arr[T(__is_pod(HasFunc))]; }
- { int arr[T(__is_pod(HasOp))]; }
- { int arr[T(__is_pod(HasConv))]; }
- { int arr[T(__is_pod(HasAssign))]; }
- { int arr[T(__is_pod(IntArNB))]; }
- { int arr[T(__is_pod(HasAnonymousUnion))]; }
- { int arr[T(__is_pod(Vector))]; }
- { int arr[T(__is_pod(VectorExt))]; }
- { int arr[T(__is_pod(Derives))]; }
- { int arr[T(__is_pod(DerivesAr))]; }
- { int arr[T(__is_pod(DerivesArNB))]; }
- { int arr[T(__is_pod(DerivesEmpty))]; }
- { int arr[T(__is_pod(HasPriv))]; }
- { int arr[T(__is_pod(HasProt))]; }
- { int arr[T(__is_pod(DerivesHasPriv))]; }
- { int arr[T(__is_pod(DerivesHasProt))]; }
-
- { int arr[F(__is_pod(HasCons))]; }
- { int arr[F(__is_pod(HasCopyAssign))]; }
- { int arr[F(__is_pod(HasMoveAssign))]; }
- { int arr[F(__is_pod(HasDest))]; }
- { int arr[F(__is_pod(HasRef))]; }
- { int arr[F(__is_pod(HasVirt))]; }
- { int arr[F(__is_pod(DerivesHasCons))]; }
- { int arr[F(__is_pod(DerivesHasCopyAssign))]; }
- { int arr[F(__is_pod(DerivesHasMoveAssign))]; }
- { int arr[F(__is_pod(DerivesHasDest))]; }
- { int arr[F(__is_pod(DerivesHasRef))]; }
- { int arr[F(__is_pod(DerivesHasVirt))]; }
- { int arr[F(__is_pod(NonPOD))]; }
- { int arr[F(__is_pod(HasNonPOD))]; }
- { int arr[F(__is_pod(NonPODAr))]; }
- { int arr[F(__is_pod(NonPODArNB))]; }
- { int arr[F(__is_pod(void))]; }
- { int arr[F(__is_pod(cvoid))]; }
-// { int arr[F(__is_pod(NonPODUnion))]; }
-
- { int arr[T(__is_pod(ACompleteType))]; }
- { int arr[F(__is_pod(AnIncompleteType))]; } // expected-error {{incomplete type}}
- { int arr[F(__is_pod(AnIncompleteType[]))]; } // expected-error {{incomplete type}}
- { int arr[F(__is_pod(AnIncompleteType[1]))]; } // expected-error {{incomplete type}}
+ static_assert(__is_pod(int), "");
+ static_assert(__is_pod(Enum), "");
+ static_assert(__is_pod(POD), "");
+ static_assert(__is_pod(Int), "");
+ static_assert(__is_pod(IntAr), "");
+ static_assert(__is_pod(Statics), "");
+ static_assert(__is_pod(Empty), "");
+ static_assert(__is_pod(EmptyUnion), "");
+ static_assert(__is_pod(Union), "");
+ static_assert(__is_pod(HasFunc), "");
+ static_assert(__is_pod(HasOp), "");
+ static_assert(__is_pod(HasConv), "");
+ static_assert(__is_pod(HasAssign), "");
+ static_assert(__is_pod(IntArNB), "");
+ static_assert(__is_pod(HasAnonymousUnion), "");
+ static_assert(__is_pod(Vector), "");
+ static_assert(__is_pod(VectorExt), "");
+ static_assert(__is_pod(Derives), "");
+ static_assert(__is_pod(DerivesAr), "");
+ static_assert(__is_pod(DerivesArNB), "");
+ static_assert(__is_pod(DerivesEmpty), "");
+ static_assert(__is_pod(HasPriv), "");
+ static_assert(__is_pod(HasProt), "");
+ static_assert(__is_pod(DerivesHasPriv), "");
+ static_assert(__is_pod(DerivesHasProt), "");
+
+ static_assert(!__is_pod(HasCons), "");
+ static_assert(!__is_pod(HasCopyAssign), "");
+ static_assert(!__is_pod(HasMoveAssign), "");
+ static_assert(!__is_pod(HasDest), "");
+ static_assert(!__is_pod(HasRef), "");
+ static_assert(!__is_pod(HasVirt), "");
+ static_assert(!__is_pod(DerivesHasCons), "");
+ static_assert(!__is_pod(DerivesHasCopyAssign), "");
+ static_assert(!__is_pod(DerivesHasMoveAssign), "");
+ static_assert(!__is_pod(DerivesHasDest), "");
+ static_assert(!__is_pod(DerivesHasRef), "");
+ static_assert(!__is_pod(DerivesHasVirt), "");
+ static_assert(!__is_pod(NonPOD), "");
+ static_assert(!__is_pod(HasNonPOD), "");
+ static_assert(!__is_pod(NonPODAr), "");
+ static_assert(!__is_pod(NonPODArNB), "");
+ static_assert(!__is_pod(void), "");
+ static_assert(!__is_pod(cvoid), "");
+// static_assert(!__is_pod(NonPODUnion), "");
+
+ static_assert(__is_pod(ACompleteType), "");
+ static_assert(!__is_pod(AnIncompleteType), ""); // expected-error {{incomplete type}}
+ static_assert(!__is_pod(AnIncompleteType[]), ""); // expected-error {{incomplete type}}
+ static_assert(!__is_pod(AnIncompleteType[1]), ""); // expected-error {{incomplete type}}
}
typedef Empty EmptyAr[10];
@@ -275,56 +273,56 @@ struct DerivesVirt : virtual POD {};
void is_empty()
{
- { int arr[T(__is_empty(Empty))]; }
- { int arr[T(__is_empty(DerivesEmpty))]; }
- { int arr[T(__is_empty(HasCons))]; }
- { int arr[T(__is_empty(HasCopyAssign))]; }
- { int arr[T(__is_empty(HasMoveAssign))]; }
- { int arr[T(__is_empty(HasDest))]; }
- { int arr[T(__is_empty(HasFunc))]; }
- { int arr[T(__is_empty(HasOp))]; }
- { int arr[T(__is_empty(HasConv))]; }
- { int arr[T(__is_empty(HasAssign))]; }
- { int arr[T(__is_empty(Bit0))]; }
- { int arr[T(__is_empty(Bit0Cons))]; }
-
- { int arr[F(__is_empty(Int))]; }
- { int arr[F(__is_empty(POD))]; }
- { int arr[F(__is_empty(EmptyUnion))]; }
- { int arr[F(__is_empty(IncompleteUnion))]; }
- { int arr[F(__is_empty(EmptyAr))]; }
- { int arr[F(__is_empty(HasRef))]; }
- { int arr[F(__is_empty(HasVirt))]; }
- { int arr[F(__is_empty(AnonBitOnly))]; }
- { int arr[F(__is_empty(BitOnly))]; }
- { int arr[F(__is_empty(void))]; }
- { int arr[F(__is_empty(IntArNB))]; }
- { int arr[F(__is_empty(HasAnonymousUnion))]; }
-// { int arr[F(__is_empty(DerivesVirt))]; }
-
- { int arr[T(__is_empty(ACompleteType))]; }
- { int arr[F(__is_empty(AnIncompleteType))]; } // expected-error {{incomplete type}}
- { int arr[F(__is_empty(AnIncompleteType[]))]; }
- { int arr[F(__is_empty(AnIncompleteType[1]))]; }
+ static_assert(__is_empty(Empty), "");
+ static_assert(__is_empty(DerivesEmpty), "");
+ static_assert(__is_empty(HasCons), "");
+ static_assert(__is_empty(HasCopyAssign), "");
+ static_assert(__is_empty(HasMoveAssign), "");
+ static_assert(__is_empty(HasDest), "");
+ static_assert(__is_empty(HasFunc), "");
+ static_assert(__is_empty(HasOp), "");
+ static_assert(__is_empty(HasConv), "");
+ static_assert(__is_empty(HasAssign), "");
+ static_assert(__is_empty(Bit0), "");
+ static_assert(__is_empty(Bit0Cons), "");
+
+ static_assert(!__is_empty(Int), "");
+ static_assert(!__is_empty(POD), "");
+ static_assert(!__is_empty(EmptyUnion), "");
+ static_assert(!__is_empty(IncompleteUnion), "");
+ static_assert(!__is_empty(EmptyAr), "");
+ static_assert(!__is_empty(HasRef), "");
+ static_assert(!__is_empty(HasVirt), "");
+ static_assert(!__is_empty(AnonBitOnly), "");
+ static_assert(!__is_empty(BitOnly), "");
+ static_assert(!__is_empty(void), "");
+ static_assert(!__is_empty(IntArNB), "");
+ static_assert(!__is_empty(HasAnonymousUnion), "");
+// static_assert(!__is_empty(DerivesVirt), "");
+
+ static_assert(__is_empty(ACompleteType), "");
+ static_assert(!__is_empty(AnIncompleteType), ""); // expected-error {{incomplete type}}
+ static_assert(!__is_empty(AnIncompleteType[]), "");
+ static_assert(!__is_empty(AnIncompleteType[1]), "");
}
typedef Derives ClassType;
void is_class()
{
- { int arr[T(__is_class(Derives))]; }
- { int arr[T(__is_class(HasPriv))]; }
- { int arr[T(__is_class(ClassType))]; }
- { int arr[T(__is_class(HasAnonymousUnion))]; }
-
- { int arr[F(__is_class(int))]; }
- { int arr[F(__is_class(Enum))]; }
- { int arr[F(__is_class(Int))]; }
- { int arr[F(__is_class(IntAr))]; }
- { int arr[F(__is_class(DerivesAr))]; }
- { int arr[F(__is_class(Union))]; }
- { int arr[F(__is_class(cvoid))]; }
- { int arr[F(__is_class(IntArNB))]; }
+ static_assert(__is_class(Derives), "");
+ static_assert(__is_class(HasPriv), "");
+ static_assert(__is_class(ClassType), "");
+ static_assert(__is_class(HasAnonymousUnion), "");
+
+ static_assert(!__is_class(int), "");
+ static_assert(!__is_class(Enum), "");
+ static_assert(!__is_class(Int), "");
+ static_assert(!__is_class(IntAr), "");
+ static_assert(!__is_class(DerivesAr), "");
+ static_assert(!__is_class(Union), "");
+ static_assert(!__is_class(cvoid), "");
+ static_assert(!__is_class(IntArNB), "");
}
typedef Union UnionAr[10];
@@ -332,17 +330,17 @@ typedef Union UnionType;
void is_union()
{
- { int arr[T(__is_union(Union))]; }
- { int arr[T(__is_union(UnionType))]; }
-
- { int arr[F(__is_union(int))]; }
- { int arr[F(__is_union(Enum))]; }
- { int arr[F(__is_union(Int))]; }
- { int arr[F(__is_union(IntAr))]; }
- { int arr[F(__is_union(UnionAr))]; }
- { int arr[F(__is_union(cvoid))]; }
- { int arr[F(__is_union(IntArNB))]; }
- { int arr[F(__is_union(HasAnonymousUnion))]; }
+ static_assert(__is_union(Union), "");
+ static_assert(__is_union(UnionType), "");
+
+ static_assert(!__is_union(int), "");
+ static_assert(!__is_union(Enum), "");
+ static_assert(!__is_union(Int), "");
+ static_assert(!__is_union(IntAr), "");
+ static_assert(!__is_union(UnionAr), "");
+ static_assert(!__is_union(cvoid), "");
+ static_assert(!__is_union(IntArNB), "");
+ static_assert(!__is_union(HasAnonymousUnion), "");
}
typedef Enum EnumType;
@@ -350,30 +348,30 @@ typedef EnumClass EnumClassType;
void is_enum()
{
- { int arr[T(__is_enum(Enum))]; }
- { int arr[T(__is_enum(EnumType))]; }
- { int arr[T(__is_enum(SignedEnum))]; }
- { int arr[T(__is_enum(UnsignedEnum))]; }
-
- { int arr[T(__is_enum(EnumClass))]; }
- { int arr[T(__is_enum(EnumClassType))]; }
- { int arr[T(__is_enum(SignedEnumClass))]; }
- { int arr[T(__is_enum(UnsignedEnumClass))]; }
-
- { int arr[F(__is_enum(int))]; }
- { int arr[F(__is_enum(Union))]; }
- { int arr[F(__is_enum(Int))]; }
- { int arr[F(__is_enum(IntAr))]; }
- { int arr[F(__is_enum(UnionAr))]; }
- { int arr[F(__is_enum(Derives))]; }
- { int arr[F(__is_enum(ClassType))]; }
- { int arr[F(__is_enum(cvoid))]; }
- { int arr[F(__is_enum(IntArNB))]; }
- { int arr[F(__is_enum(HasAnonymousUnion))]; }
- { int arr[F(__is_enum(AnIncompleteType))]; }
- { int arr[F(__is_enum(AnIncompleteTypeAr))]; }
- { int arr[F(__is_enum(AnIncompleteTypeArMB))]; }
- { int arr[F(__is_enum(AnIncompleteTypeArNB))]; }
+ static_assert(__is_enum(Enum), "");
+ static_assert(__is_enum(EnumType), "");
+ static_assert(__is_enum(SignedEnum), "");
+ static_assert(__is_enum(UnsignedEnum), "");
+
+ static_assert(__is_enum(EnumClass), "");
+ static_assert(__is_enum(EnumClassType), "");
+ static_assert(__is_enum(SignedEnumClass), "");
+ static_assert(__is_enum(UnsignedEnumClass), "");
+
+ static_assert(!__is_enum(int), "");
+ static_assert(!__is_enum(Union), "");
+ static_assert(!__is_enum(Int), "");
+ static_assert(!__is_enum(IntAr), "");
+ static_assert(!__is_enum(UnionAr), "");
+ static_assert(!__is_enum(Derives), "");
+ static_assert(!__is_enum(ClassType), "");
+ static_assert(!__is_enum(cvoid), "");
+ static_assert(!__is_enum(IntArNB), "");
+ static_assert(!__is_enum(HasAnonymousUnion), "");
+ static_assert(!__is_enum(AnIncompleteType), "");
+ static_assert(!__is_enum(AnIncompleteTypeAr), "");
+ static_assert(!__is_enum(AnIncompleteTypeArMB), "");
+ static_assert(!__is_enum(AnIncompleteTypeArNB), "");
}
void is_scoped_enum() {
@@ -421,20 +419,20 @@ struct PotentiallyFinal<int> final { };
void is_final()
{
- { int arr[T(__is_final(FinalClass))]; }
- { int arr[T(__is_final(PotentiallyFinal<float*>))]; }
- { int arr[T(__is_final(PotentiallyFinal<int>))]; }
-
- { int arr[F(__is_final(int))]; }
- { int arr[F(__is_final(Union))]; }
- { int arr[F(__is_final(Int))]; }
- { int arr[F(__is_final(IntAr))]; }
- { int arr[F(__is_final(UnionAr))]; }
- { int arr[F(__is_final(Derives))]; }
- { int arr[F(__is_final(ClassType))]; }
- { int arr[F(__is_final(cvoid))]; }
- { int arr[F(__is_final(IntArNB))]; }
- { int arr[F(__is_final(HasAnonymousUnion))]; }
+ static_assert(__is_final(FinalClass), "");
+ static_assert(__is_final(PotentiallyFinal<float*>), "");
+ static_assert(__is_final(PotentiallyFinal<int>), "");
+
+ static_assert(!__is_final(int), "");
+ static_assert(!__is_final(Union), "");
+ static_assert(!__is_final(Int), "");
+ static_assert(!__is_final(IntAr), "");
+ static_assert(!__is_final(UnionAr), "");
+ static_assert(!__is_final(Derives), "");
+ static_assert(!__is_final(ClassType), "");
+ static_assert(!__is_final(cvoid), "");
+ static_assert(!__is_final(IntArNB), "");
+ static_assert(!__is_final(HasAnonymousUnion), "");
}
@@ -443,78 +441,78 @@ struct InheritPolymorph : Polymorph {};
void is_polymorphic()
{
- { int arr[T(__is_polymorphic(Polymorph))]; }
- { int arr[T(__is_polymorphic(InheritPolymorph))]; }
-
- { int arr[F(__is_polymorphic(int))]; }
- { int arr[F(__is_polymorphic(Union))]; }
- { int arr[F(__is_polymorphic(IncompleteUnion))]; }
- { int arr[F(__is_polymorphic(Int))]; }
- { int arr[F(__is_polymorphic(IntAr))]; }
- { int arr[F(__is_polymorphic(UnionAr))]; }
- { int arr[F(__is_polymorphic(Derives))]; }
- { int arr[F(__is_polymorphic(ClassType))]; }
- { int arr[F(__is_polymorphic(Enum))]; }
- { int arr[F(__is_polymorphic(cvoid))]; }
- { int arr[F(__is_polymorphic(IntArNB))]; }
+ static_assert(__is_polymorphic(Polymorph), "");
+ static_assert(__is_polymorphic(InheritPolymorph), "");
+
+ static_assert(!__is_polymorphic(int), "");
+ static_assert(!__is_polymorphic(Union), "");
+ static_assert(!__is_polymorphic(IncompleteUnion), "");
+ static_assert(!__is_polymorphic(Int), "");
+ static_assert(!__is_polymorphic(IntAr), "");
+ static_assert(!__is_polymorphic(UnionAr), "");
+ static_assert(!__is_polymorphic(Derives), "");
+ static_assert(!__is_polymorphic(ClassType), "");
+ static_assert(!__is_polymorphic(Enum), "");
+ static_assert(!__is_polymorphic(cvoid), "");
+ static_assert(!__is_polymorphic(IntArNB), "");
}
void is_integral()
{
- int t01[T(__is_integral(bool))];
- int t02[T(__is_integral(char))];
- int t03[T(__is_integral(signed char))];
- int t04[T(__is_integral(unsigned char))];
- //int t05[T(__is_integral(char16_t))];
- //int t06[T(__is_integral(char32_t))];
- int t07[T(__is_integral(wchar_t))];
- int t08[T(__is_integral(short))];
- int t09[T(__is_integral(unsigned short))];
- int t10[T(__is_integral(int))];
- int t11[T(__is_integral(unsigned int))];
- int t12[T(__is_integral(long))];
- int t13[T(__is_integral(unsigned long))];
-
- int t21[F(__is_integral(float))];
- int t22[F(__is_integral(double))];
- int t23[F(__is_integral(long double))];
- int t24[F(__is_integral(Union))];
- int t25[F(__is_integral(UnionAr))];
- int t26[F(__is_integral(Derives))];
- int t27[F(__is_integral(ClassType))];
- int t28[F(__is_integral(Enum))];
- int t29[F(__is_integral(void))];
- int t30[F(__is_integral(cvoid))];
- int t31[F(__is_integral(IntArNB))];
+ static_assert(__is_integral(bool), "");
+ static_assert(__is_integral(char), "");
+ static_assert(__is_integral(signed char), "");
+ static_assert(__is_integral(unsigned char), "");
+ //static_assert(__is_integral(char16_t), "");
+ //static_assert(__is_integral(char32_t), "");
+ static_assert(__is_integral(wchar_t), "");
+ static_assert(__is_integral(short), "");
+ static_assert(__is_integral(unsigned short), "");
+ static_assert(__is_integral(int), "");
+ static_assert(__is_integral(unsigned int), "");
+ static_assert(__is_integral(long), "");
+ static_assert(__is_integral(unsigned long), "");
+
+ static_assert(!__is_integral(float), "");
+ static_assert(!__is_integral(double), "");
+ static_assert(!__is_integral(long double), "");
+ static_assert(!__is_integral(Union), "");
+ static_assert(!__is_integral(UnionAr), "");
+ static_assert(!__is_integral(Derives), "");
+ static_assert(!__is_integral(ClassType), "");
+ static_assert(!__is_integral(Enum), "");
+ static_assert(!__is_integral(void), "");
+ static_assert(!__is_integral(cvoid), "");
+ static_assert(!__is_integral(IntArNB), "");
}
void is_floating_point()
{
- int t01[T(__is_floating_point(float))];
- int t02[T(__is_floating_point(double))];
- int t03[T(__is_floating_point(long double))];
-
- int t11[F(__is_floating_point(bool))];
- int t12[F(__is_floating_point(char))];
- int t13[F(__is_floating_point(signed char))];
- int t14[F(__is_floating_point(unsigned char))];
- //int t15[F(__is_floating_point(char16_t))];
- //int t16[F(__is_floating_point(char32_t))];
- int t17[F(__is_floating_point(wchar_t))];
- int t18[F(__is_floating_point(short))];
- int t19[F(__is_floating_point(unsigned short))];
- int t20[F(__is_floating_point(int))];
- int t21[F(__is_floating_point(unsigned int))];
- int t22[F(__is_floating_point(long))];
- int t23[F(__is_floating_point(unsigned long))];
- int t24[F(__is_floating_point(Union))];
- int t25[F(__is_floating_point(UnionAr))];
- int t26[F(__is_floating_point(Derives))];
- int t27[F(__is_floating_point(ClassType))];
- int t28[F(__is_floating_point(Enum))];
- int t29[F(__is_floating_point(void))];
- int t30[F(__is_floating_point(cvoid))];
- int t31[F(__is_floating_point(IntArNB))];
+ static_assert(__is_floating_point(float), "");
+ static_assert(__is_floating_point(double), "");
+ static_assert(__is_floating_point(long double), "");
+
+ static_assert(!__is_floating_point(bool), "");
+ static_assert(!__is_floating_point(char), "");
+ static_assert(!__is_floating_point(signed char), "");
+ static_assert(!__is_floating_point(unsigned char), "");
+ //static_assert(!__is_floating_point(char16_t), "");
+ //static_assert(!__is_floating_point(char32_t), "");
+ static_assert(!__is_floating_point(wchar_t), "");
+ static_assert(!__is_floating_point(short), "");
+ static_assert(!__is_floating_point(unsigned short), "");
+ static_assert(!__is_floating_point(int), "");
+ static_assert(!__is_floating_point(unsigned int), "");
+ static_assert(!__is_floating_point(long), "");
+ static_assert(!__is_floating_point(unsigned long), "");
+ static_assert(!__is_floating_point(Union), "");
+ static_assert(!__is_floating_point(UnionAr), "");
+ static_assert(!__is_floating_point(Derives), "");
+ static_assert(!__is_floating_point(ClassType), "");
+ static_assert(!__is_floating_point(Enum), "");
+ static_assert(!__is_floating_point(void), "");
+ static_assert(!__is_floating_point(cvoid), "");
+ static_assert(!__is_floating_point(IntArNB), "");
}
template <class T>
@@ -604,113 +602,113 @@ void is_aggregate()
void is_arithmetic()
{
- int t01[T(__is_arithmetic(float))];
- int t02[T(__is_arithmetic(double))];
- int t03[T(__is_arithmetic(long double))];
- int t11[T(__is_arithmetic(bool))];
- int t12[T(__is_arithmetic(char))];
- int t13[T(__is_arithmetic(signed char))];
- int t14[T(__is_arithmetic(unsigned char))];
- //int t15[T(__is_arithmetic(char16_t))];
- //int t16[T(__is_arithmetic(char32_t))];
- int t17[T(__is_arithmetic(wchar_t))];
- int t18[T(__is_arithmetic(short))];
- int t19[T(__is_arithmetic(unsigned short))];
- int t20[T(__is_arithmetic(int))];
- int t21[T(__is_arithmetic(unsigned int))];
- int t22[T(__is_arithmetic(long))];
- int t23[T(__is_arithmetic(unsigned long))];
-
- int t24[F(__is_arithmetic(Union))];
- int t25[F(__is_arithmetic(UnionAr))];
- int t26[F(__is_arithmetic(Derives))];
- int t27[F(__is_arithmetic(ClassType))];
- int t28[F(__is_arithmetic(Enum))];
- int t29[F(__is_arithmetic(void))];
- int t30[F(__is_arithmetic(cvoid))];
- int t31[F(__is_arithmetic(IntArNB))];
+ static_assert(__is_arithmetic(float), "");
+ static_assert(__is_arithmetic(double), "");
+ static_assert(__is_arithmetic(long double), "");
+ static_assert(__is_arithmetic(bool), "");
+ static_assert(__is_arithmetic(char), "");
+ static_assert(__is_arithmetic(signed char), "");
+ static_assert(__is_arithmetic(unsigned char), "");
+ //static_assert(__is_arithmetic(char16_t), "");
+ //static_assert...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/77584
More information about the cfe-commits
mailing list