Added test to ensure that alignments of ctti_data and char are same

This commit is contained in:
Antony Polukhin committed 2014-03-06 11:39:10 +04:00
1 parent 3f51425f3c
commit a2a934dde8
3 files changed
+21

No files matched your search

+1
View File
@@ -40,6 +40,7 @@ test-suite type_index
[ run testing_crossmodule.cpp test_lib_nortti $(tlib) : : : <rtti>off : testing_crossmodule_no_rtti ]
[ compile-fail type_index_test_ctti_copy_fail.cpp ]
[ compile-fail type_index_test_ctti_construct_fail.cpp ]
[ compile type_index_test_ctti_alignment.cpp ]
# Mixing RTTI on and off
[ link-fail testing_crossmodule.cpp $(tlib) test_lib_rtti : $(nortti) : link_fail_nortti_rtti ]
+18
View File
@@ -0,0 +1,18 @@
//
// Copyright Antony Polukhin, 2012-2013.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/type_index/ctti_type_index.hpp>
#include <boost/type_traits/alignment_of.hpp>
int main() {
BOOST_STATIC_ASSERT_MSG(
boost::alignment_of<boost::typeind::detail::ctti_data>::value == boost::alignment_of<char>::value,
"Alignments of boost::typeind::detail::ctti_data and char differ. "
"It is unsafe to reinterpret_cast between them."
);
}