• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Test BOOST_TEST_EQ( p, nullptr )
3 //
4 // Copyright 2017 Peter Dimov
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
9 //
10 
11 #if defined(_MSC_VER)
12 # pragma warning( disable: 4100 ) // nullptr_t parameter unrereferenced
13 #endif
14 
15 #include <boost/core/lightweight_test.hpp>
16 #include <boost/config.hpp>
17 
main()18 int main()
19 {
20 #if !defined( BOOST_NO_CXX11_NULLPTR )
21 
22     int x = 0;
23     int* p1 = 0;
24     int* p2 = &x;
25 
26     BOOST_TEST_EQ( p1, nullptr );
27     BOOST_TEST_NE( p2, nullptr );
28 
29     BOOST_TEST_EQ( nullptr, p1 );
30     BOOST_TEST_NE( nullptr, p2 );
31 
32 #endif
33 
34     return boost::report_errors();
35 }
36