1 // 2 // Copyright 2013 Peter Dimov 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // See accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt 7 // 8 9 #include <boost/utility/addressof.hpp> 10 #include <boost/core/lightweight_test.hpp> 11 #include <cstddef> 12 13 #if defined( BOOST_NO_CXX11_NULLPTR ) 14 nullptr_test()15void nullptr_test() 16 { 17 } 18 19 #else 20 nullptr_test()21void nullptr_test() 22 { 23 { 24 auto x = nullptr; 25 BOOST_TEST( boost::addressof(x) == &x ); 26 } 27 28 { 29 auto const x = nullptr; 30 BOOST_TEST( boost::addressof(x) == &x ); 31 } 32 33 { 34 auto volatile x = nullptr; 35 BOOST_TEST( boost::addressof(x) == &x ); 36 } 37 38 { 39 auto const volatile x = nullptr; 40 BOOST_TEST( boost::addressof(x) == &x ); 41 } 42 } 43 44 #endif 45 main()46int main() 47 { 48 nullptr_test(); 49 return boost::report_errors(); 50 } 51