https://github.com/AMP999 created https://github.com/llvm/llvm-project/pull/91412
None >From 541910fc90064e5491622245d9e94759cffa4d15 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri <ar.ashouri...@gmail.com> Date: Wed, 8 May 2024 03:09:38 +0330 Subject: [PATCH] [clang]Add additional test coverage for `__is_trivially_relocatable(T)` --- clang/test/SemaCXX/type-traits.cpp | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits