Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / config / test / boost_no_cxx11_std_align.ipp
1 //  (C) Copyright John Maddock 2012
2 //  (C) Copyright Peter Dimov 2014
3
4 //  Use, modification and distribution are subject to the
5 //  Boost Software License, Version 1.0. (See accompanying file
6 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 //  See http://www.boost.org/libs/config for more information.
9
10 //  MACRO:         BOOST_NO_CXX11_STD_ALIGN
11 //  TITLE:         C++11 <memory> doesn't have a working std::align
12 //  DESCRIPTION:   The compiler does not support the function std::align added to <memory>
13
14 #include <memory>
15
16 namespace boost_no_cxx11_std_align {
17
18 int test()
19 {
20    char buffer[ 32 ];
21
22    void * ptr = buffer + 1;
23    std::size_t space = sizeof( buffer ) - 1;
24
25    void * p2 = std::align( 4, 2, ptr, space );
26
27    if( p2 == 0 ) return 1;
28    if( p2 != ptr ) return 1;
29    if( (size_t)p2 % 4 ) return 1;
30
31    return 0;
32 }
33
34 }