diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-07-19 21:11:51 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-07-19 22:47:36 +0200 |
commit | e1af6fefa0f0b919ccdacc9edfbae034e6347d46 (patch) | |
tree | 8c9e589e4f094ec1140a416ddc3b97c9998f1c68 /include/rtl/ustring.hxx | |
parent | 3e397cd3ee1dc2720a380a9945f5d5d295997e9b (diff) |
offsetof is only guaranteed to work with standard layout types
Change-Id: If9ba41a219d3c3b5bff838104b9a0df53030b8f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119181
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/rtl/ustring.hxx')
-rw-r--r-- | include/rtl/ustring.hxx | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 2699c09ac03f..96bb504f77a8 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -110,6 +110,7 @@ private: static constexpr void assertLayout() { // These static_asserts verifying the layout compatibility with rtl_uString cannot be class // member declarations, as offsetof requires a complete type, so defer them to here: + static_assert(std::is_standard_layout_v<OUStringLiteral>); static_assert(offsetof(OUStringLiteral, str.refCount) == offsetof(OUStringLiteral, more.refCount)); static_assert(offsetof(OUStringLiteral, str.length) == offsetof(OUStringLiteral, more.length)); static_assert(offsetof(OUStringLiteral, str.buffer) == offsetof(OUStringLiteral, more.buffer)); |