diff --git a/test/aligned_storage_test.cpp b/test/aligned_storage_test.cpp index 3752b67..ecf105e 100644 --- a/test/aligned_storage_test.cpp +++ b/test/aligned_storage_test.cpp @@ -14,10 +14,26 @@ # include #endif +template +union must_be_pod +{ + int i; + T t; +}; + +template +void no_unused_warning(const volatile T&) +{ +} + template void check(const T&) { typedef typename tt::aligned_storage::type t1; + t1 as1 = { 0, }; + must_be_pod pod1; + no_unused_warning(as1); + no_unused_warning(pod1); BOOST_MESSAGE(typeid(t1).name()); BOOST_CHECK(::tt::alignment_of::value == T::value); BOOST_CHECK(sizeof(t1) == T::value); @@ -25,6 +41,10 @@ void check(const T&) BOOST_CHECK(::tt::is_pod::value == true); #endif typedef typename tt::aligned_storage::type t2; + t2 as2 = { 0, }; + must_be_pod pod2; + no_unused_warning(as2); + no_unused_warning(pod2); BOOST_MESSAGE(typeid(t2).name()); BOOST_CHECK(::tt::alignment_of::value == T::value); BOOST_CHECK(sizeof(t2) == T::value*2); @@ -33,6 +53,10 @@ void check(const T&) #endif typedef typename tt::aligned_storage::type t3; + t3 as3 = { 0, }; + must_be_pod pod3; + no_unused_warning(as3); + no_unused_warning(pod3); BOOST_MESSAGE(typeid(t3).name()); BOOST_CHECK(::tt::alignment_of::value == ::boost::alignment_of< ::boost::detail::max_align>::value); BOOST_CHECK((sizeof(t3) % T::value) == 0);