From 82d40e63a26f1c6bb8836cc4a38af18d6c172478 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 16 Dec 2024 12:19:29 -0800 Subject: [PATCH] static_assert that absl::Time and absl::Duration are trivially destructible. PiperOrigin-RevId: 706793904 Change-Id: I1c7c9b871db73ca9910fd8fbaa52511da2872de0 --- absl/time/duration_test.cc | 3 +++ absl/time/time_test.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/absl/time/duration_test.cc b/absl/time/duration_test.cc index 416bf3ca4eb..573a76ab68f 100644 --- a/absl/time/duration_test.cc +++ b/absl/time/duration_test.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -74,6 +75,8 @@ MATCHER_P(TimevalMatcher, tv, "") { } TEST(Duration, ConstExpr) { + static_assert(std::is_trivially_destructible::value, + "Duration is documented as being trivially destructible"); constexpr absl::Duration d0 = absl::ZeroDuration(); static_assert(d0 == absl::ZeroDuration(), "ZeroDuration()"); constexpr absl::Duration d1 = absl::Seconds(1); diff --git a/absl/time/time_test.cc b/absl/time/time_test.cc index 69e93e98ee4..6f21008ac8d 100644 --- a/absl/time/time_test.cc +++ b/absl/time/time_test.cc @@ -37,6 +37,7 @@ #include #include #include +#include #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -89,6 +90,8 @@ MATCHER_P(TimevalMatcher, tv, "") { } TEST(Time, ConstExpr) { + static_assert(std::is_trivially_destructible::value, + "Time is documented as being trivially destructible"); constexpr absl::Time t0 = absl::UnixEpoch(); static_assert(t0 == absl::UnixEpoch(), "UnixEpoch"); constexpr absl::Time t1 = absl::InfiniteFuture();