summaryrefslogtreecommitdiff
path: root/absl/meta/type_traits_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/meta/type_traits_test.cc')
-rw-r--r--absl/meta/type_traits_test.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/absl/meta/type_traits_test.cc b/absl/meta/type_traits_test.cc
index 3e7cfbe7..d9e36887 100644
--- a/absl/meta/type_traits_test.cc
+++ b/absl/meta/type_traits_test.cc
@@ -743,6 +743,23 @@ TEST(TypeTraitsTest, IsNothrowSwappable) {
EXPECT_TRUE(IsNothrowSwappable<adl_namespace::SpecialNoexceptSwap>::value);
}
+TEST(TriviallyRelocatable, PrimitiveTypes) {
+ static_assert(absl::is_trivially_relocatable<int>::value, "");
+ static_assert(absl::is_trivially_relocatable<char>::value, "");
+ static_assert(absl::is_trivially_relocatable<void*>::value, "");
+}
+
+// User-defined types can be trivially relocatable as long as they don't have a
+// user-provided move constructor or destructor.
+TEST(TriviallyRelocatable, UserDefinedTriviallyReconstructible) {
+ struct S {
+ int x;
+ int y;
+ };
+
+ static_assert(absl::is_trivially_relocatable<S>::value, "");
+}
+
// A user-provided move constructor disqualifies a type from being trivially
// relocatable.
TEST(TriviallyRelocatable, UserProvidedMoveConstructor) {