summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/value_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/value_internal.h')
-rw-r--r--src/mongo/db/pipeline/value_internal.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/value_internal.h b/src/mongo/db/pipeline/value_internal.h
index 51d76e6cf73..79a378c2a6a 100644
--- a/src/mongo/db/pipeline/value_internal.h
+++ b/src/mongo/db/pipeline/value_internal.h
@@ -76,7 +76,6 @@ public:
const Decimal128 decimalValue;
};
-#pragma pack(1)
class ValueStorage {
public:
// Note: it is important the memory is zeroed out (by calling zero()) at the start of every
@@ -311,6 +310,7 @@ public:
// This data is public because this should only be used by Value which would be a friend
union {
+#pragma pack(1)
struct {
// byte 1
signed char type;
@@ -354,11 +354,16 @@ public:
};
};
};
+#pragma pack()
// covers the whole ValueStorage
long long i64[2];
+
+ // Forces the ValueStorage type to have at least pointer alignment. Can't use alignas on the
+ // type since that causes issues on MSVC.
+ void* forcePointerAlignment;
};
};
MONGO_STATIC_ASSERT(sizeof(ValueStorage) == 16);
-#pragma pack()
+MONGO_STATIC_ASSERT(alignof(ValueStorage) >= alignof(void*));
}