/* (c) 2014-2015 Glen Joseph Fernandes Distributed under the Boost Software License, Version 1.0. http://boost.org/LICENSE_1_0.txt */ #include #include #include #include template struct A { }; template struct P { P() : p(new T) { } ~P() { delete p; } T* p; }; template void test(char* p, A) { BOOST_TEST(boost::alignment::is_aligned(p, N)); BOOST_TEST(!boost::alignment::is_aligned(&p[1], N)); } void test(char* p, A<1>) { BOOST_TEST(boost::alignment::is_aligned(p, 1)); } template void test() { P o; test(reinterpret_cast(o.p), A::value>()); } class X; int main() { test(); test(); test(); #if !defined(BOOST_NO_CXX11_CHAR16_T) test(); #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) test(); #endif test(); test(); test(); #if !defined(BOOST_NO_LONG_LONG) test(); #endif test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); return boost::report_errors(); }