[clang] [clang]Add additional test coverage for `__is_trivially_relocatable(T)` (PR #91412)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 16:45:49 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Amirreza Ashouri (AMP999)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/91412.diff


1 Files Affected:

- (modified) clang/test/SemaCXX/type-traits.cpp (+45) 


``````````diff
diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp
index 01991887b284a..05fef05dc6ce0 100644
--- a/clang/test/SemaCXX/type-traits.cpp
+++ b/clang/test/SemaCXX/type-traits.cpp
@@ -1433,6 +1433,51 @@ void is_trivially_copyable2()
   static_assert(!__is_trivially_copyable(const volatile void));
 }
 
+void is_trivially_relocatable2()
+{
+  static_assert(__is_trivially_relocatable(char));
+  static_assert(__is_trivially_relocatable(int));
+  static_assert(__is_trivially_relocatable(long));
+  static_assert(__is_trivially_relocatable(short));
+  static_assert(__is_trivially_relocatable(signed char));
+  static_assert(__is_trivially_relocatable(wchar_t));
+  static_assert(__is_trivially_relocatable(bool));
+  static_assert(__is_trivially_relocatable(float));
+  static_assert(__is_trivially_relocatable(double));
+  static_assert(__is_trivially_relocatable(long double));
+  static_assert(__is_trivially_relocatable(unsigned char));
+  static_assert(__is_trivially_relocatable(unsigned int));
+  static_assert(__is_trivially_relocatable(unsigned long long));
+  static_assert(__is_trivially_relocatable(unsigned long));
+  static_assert(__is_trivially_relocatable(unsigned short));
+  static_assert(__is_trivially_relocatable(ClassType));
+  static_assert(__is_trivially_relocatable(Derives));
+  static_assert(__is_trivially_relocatable(Enum));
+  static_assert(__is_trivially_relocatable(IntAr));
+  static_assert(__is_trivially_relocatable(Union));
+  static_assert(__is_trivially_relocatable(UnionAr));
+  static_assert(__is_trivially_relocatable(TrivialStruct));
+  static_assert(__is_trivially_relocatable(NonTrivialStruct));
+  static_assert(__is_trivially_relocatable(AllDefaulted));
+  static_assert(!__is_trivially_relocatable(AllDeleted));
+
+  static_assert(!__is_trivially_relocatable(void));
+  static_assert(!__is_trivially_relocatable(SuperNonTrivialStruct));
+  static_assert(!__is_trivially_relocatable(NonTCStruct));
+  static_assert(!__is_trivially_relocatable(ExtDefaulted));
+
+  static_assert(__is_trivially_relocatable(const int));
+  static_assert(__is_trivially_relocatable(volatile int));
+
+  static_assert(__is_trivially_relocatable(ACompleteType));
+  static_assert(!__is_trivially_relocatable(AnIncompleteType)); // expected-error {{incomplete type}}
+  static_assert(!__is_trivially_relocatable(AnIncompleteType[])); // expected-error {{incomplete type}}
+  static_assert(!__is_trivially_relocatable(AnIncompleteType[1])); // expected-error {{incomplete type}}
+  static_assert(!__is_trivially_relocatable(void));
+  static_assert(!__is_trivially_relocatable(const volatile void));
+}
+
+
 struct CStruct {
   int one;
   int two;

``````````

</details>


https://github.com/llvm/llvm-project/pull/91412


More information about the cfe-commits mailing list