Skip to content

Fix compilation errors with C++17 feature #1260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion util/env_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ 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<SingletonEnv<EnvType>>);
static_assert(std::is_standard_layout<SingletonEnv<EnvType>>::value);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You likely need the message as well to be C++11 compatible

Suggested change
static_assert(std::is_standard_layout<SingletonEnv<EnvType>>::value);
static_assert(std::is_standard_layout<SingletonEnv<EnvType>>::value,
"SingletonEnv<EnvType> is not standard layout");

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, haven't seen it before, close this now.

static_assert(
offsetof(SingletonEnv<EnvType>, env_storage_) % alignof(EnvType) == 0,
"env_storage_ does not meet the Env's alignment needs");
Expand Down
2 changes: 1 addition & 1 deletion util/env_windows.cc
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ 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<SingletonEnv<EnvType>>);
static_assert(std::is_standard_layout<SingletonEnv<EnvType>>::value);
static_assert(
offsetof(SingletonEnv<EnvType>, env_storage_) % alignof(EnvType) == 0,
"env_storage_ does not meet the Env's alignment needs");
Expand Down
2 changes: 1 addition & 1 deletion util/no_destructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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<NoDestructor<InstanceType>>);
static_assert(std::is_standard_layout<NoDestructor<InstanceType>>::value);
static_assert(
offsetof(NoDestructor, instance_storage_) % alignof(InstanceType) == 0,
"instance_storage_ does not meet the instance's alignment requirement");
Expand Down