From 16c2b79d4d27a66b7e9da31117e01343e5b2d991 Mon Sep 17 00:00:00 2001 From: JalanChao Date: Thu, 13 Feb 2025 20:56:08 +0800 Subject: [PATCH] Fix the issue that prevents compilation in C++11 --- util/env_posix.cc | 3 ++- util/env_windows.cc | 3 ++- util/no_destructor.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index c2490322e..628043fe6 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -874,7 +874,8 @@ class SingletonEnv { #endif // !defined(NDEBUG) static_assert(sizeof(env_storage_) >= sizeof(EnvType), "env_storage_ will not fit the Env"); - static_assert(std::is_standard_layout_v>); + static_assert(std::is_standard_layout>::value, + "SingletonEnv is not a standard layout type"); static_assert( offsetof(SingletonEnv, env_storage_) % alignof(EnvType) == 0, "env_storage_ does not meet the Env's alignment needs"); diff --git a/util/env_windows.cc b/util/env_windows.cc index ae5149a50..077e97493 100644 --- a/util/env_windows.cc +++ b/util/env_windows.cc @@ -769,7 +769,8 @@ class SingletonEnv { #endif // !defined(NDEBUG) static_assert(sizeof(env_storage_) >= sizeof(EnvType), "env_storage_ will not fit the Env"); - static_assert(std::is_standard_layout_v>); + static_assert(std::is_standard_layout>::value, + "SingletonEnv, env_storage_) % alignof(EnvType) == 0, "env_storage_ does not meet the Env's alignment needs"); diff --git a/util/no_destructor.h b/util/no_destructor.h index c28a10731..50cd53985 100644 --- a/util/no_destructor.h +++ b/util/no_destructor.h @@ -21,7 +21,8 @@ class NoDestructor { explicit NoDestructor(ConstructorArgTypes&&... constructor_args) { static_assert(sizeof(instance_storage_) >= sizeof(InstanceType), "instance_storage_ is not large enough to hold the instance"); - static_assert(std::is_standard_layout_v>); + static_assert(std::is_standard_layout>::value, + "NoDestructor is not a standard layout type"); static_assert( offsetof(NoDestructor, instance_storage_) % alignof(InstanceType) == 0, "instance_storage_ does not meet the instance's alignment requirement");