From 9016ec6fbb54eddfac81deacb0f30f3def1733c6 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Wed, 1 Jun 2016 15:34:02 -0700 Subject: [PATCH] PackedSyncPtr.data_ is private Summary: As the (now removed) comment says, GCC 4.6 doesn't treat structs with private members as POD types... The thing is, GCC 4.6 is long dead, so make `data_` private and assert that it's a POD type. Reviewed By: meyering Differential Revision: D3373172 fbshipit-source-id: b2f1ee59d544461fe986705164cc6c866af62865 --- folly/PackedSyncPtr.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/folly/PackedSyncPtr.h b/folly/PackedSyncPtr.h index 74c5ab8f..00dc1e22 100644 --- a/folly/PackedSyncPtr.h +++ b/folly/PackedSyncPtr.h @@ -133,14 +133,13 @@ public: data_.setData((uintptr_t(extra) << 48) | ptr); } - // Logically private, but we can't have private data members and - // still be considered a POD. (In C++11 we are still a standard - // layout struct if this is private, but it doesn't matter, since - // gcc (4.6) won't let us use this with attribute packed still in - // that case.) + private: PicoSpinLock data_; }; +static_assert( + std::is_pod>::value, + "PackedSyncPtr must be kept a POD type."); static_assert(sizeof(PackedSyncPtr) == 8, "PackedSyncPtr should be only 8 bytes---something is " "messed up"); -- 2.34.1