From b2df302733196d7d58d4413cf02a42f69a4e8f42 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 14 May 2024 22:52:23 +0300 Subject: [PATCH] Update test_attribute_packed --- test/test_attribute_packed.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/test_attribute_packed.cpp b/test/test_attribute_packed.cpp index 505639b3..8947d2d2 100644 --- a/test/test_attribute_packed.cpp +++ b/test/test_attribute_packed.cpp @@ -16,7 +16,14 @@ int main() {} using namespace boost::uuids; -struct __attribute__((packed)) X +struct __attribute__((packed)) X1 +{ + unsigned char a; + uuid b; + unsigned char c; +}; + +struct __attribute__((packed)) X2 { uuid a; unsigned char b; @@ -26,8 +33,11 @@ struct __attribute__((packed)) X int main() { - BOOST_TEST_EQ( offsetof(X, c), 17 ); - BOOST_TEST_EQ( sizeof(X), 22 ); + BOOST_TEST_EQ( offsetof(X1, b), 1 ); + BOOST_TEST_EQ( sizeof(X1), 18 ); + + BOOST_TEST_EQ( offsetof(X2, c), 17 ); + BOOST_TEST_EQ( sizeof(X2), 22 ); return boost::report_errors(); }