Fix alignment test for 32 bit Linux/macOS

This commit is contained in:
Peter Dimov
2020-03-12 00:59:43 +02:00
parent 38598d02a3
commit 2b101c64a9

View File

@ -17,11 +17,17 @@ template<class T> struct align
} }
}; };
template<class T> struct align2
{
char _;
T v;
};
template<class T, class U> void test_buffer( U const & y, bool aligned ) template<class T, class U> void test_buffer( U const & y, bool aligned )
{ {
align<T> x( y ); align<T> x( y );
BOOST_TEST_EQ( sizeof(x), aligned? 2 * sizeof(U): 1 + sizeof(U) ); BOOST_TEST_EQ( sizeof(x), aligned? sizeof( align2<U> ): 1 + sizeof(U) );
BOOST_TEST_EQ( x.v.value(), y ); BOOST_TEST_EQ( x.v.value(), y );
} }