/* Copyright 2014 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #include #include #include #include template struct remove_reference { typedef T type; }; template struct remove_reference { typedef T type; }; #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template struct remove_reference { typedef T type; }; #endif template struct remove_all_extents { typedef T type; }; template struct remove_all_extents { typedef typename remove_all_extents::type type; }; template struct remove_all_extents { typedef typename remove_all_extents::type type; }; template struct remove_cv { typedef T type; }; template struct remove_cv { typedef T type; }; template struct remove_cv { typedef T type; }; template struct remove_cv { typedef T type; }; template struct offset_value { char value; typename remove_cv::type>::type>::type object; }; template void test_type() { enum { N = boost::alignment::alignment_of::value }; BOOST_TEST(offsetof(offset_value, object) == N); } template void test_reference() { test_type(); test_type(); #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) test_type(); #endif } template void test_array() { test_reference(); test_reference(); test_type(); } template void test_cv() { test_array(); test_array(); test_array(); test_array(); } template struct Struct { T t; }; template union Union { T t; }; template void test() { test_cv(); test_cv >(); test_cv >(); } void test_integral() { test(); test(); test(); test(); test(); #if !defined(BOOST_NO_CXX11_CHAR16_T) test(); #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) test(); #endif test(); test(); test(); test(); test(); test(); #if !defined(BOOST_NO_LONG_LONG) test(); test(); #endif } void test_floating_point() { test(); test(); test(); } void test_nullptr_t() { #if !defined(BOOST_NO_CXX11_NULLPTR) && \ !defined(BOOST_NO_CXX11_DECLTYPE) test(); #endif } class X; void test_pointer() { test(); test(); test(); test(); test(); } void test_member_pointer() { test(); test(); } enum E { V = 1 }; void test_enum() { test(); } struct S { }; class C { }; union U { }; void test_class() { test(); test(); test(); } int main() { test_integral(); test_floating_point(); test_nullptr_t(); test_pointer(); test_member_pointer(); test_enum(); test_class(); return boost::report_errors(); }