#include #include namespace boost { template T* get_pointer(T*); template T* get_pointer(std::auto_ptr const&); // Used to test order sensitivity template T* get_pointer2(T*); template T* get_pointer2(std::auto_ptr const&); } #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) || defined(__BORLANDC__) # define BOOST_GET_POINTER_IN_BOOST #endif namespace user { template struct Y{}; #ifdef BOOST_GET_POINTER_IN_BOOST } namespace boost { #endif template T* get_pointer(user::Y); #ifdef BOOST_GET_POINTER_IN_BOOST } namespace user { #endif #if defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) \ || defined(__GNUC__) && __GNUC__ == 2 using boost::get_pointer; #endif template int f(T x) { #if !(defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER)) using boost::get_pointer; // conforming compilers require // this one to find the auto_ptr // and T* overloads #endif return get_pointer(x) == 0; } } namespace boost { namespace inner2 { template struct X {}; #ifdef BOOST_GET_POINTER_IN_BOOST } #endif template T* get_pointer(inner2::X); #ifdef BOOST_GET_POINTER_IN_BOOST namespace inner2 { #endif } namespace inner1 { template int f(T x) { return get_pointer(x) == 0; } template int g(T x) { return get_pointer2(x) == 0; } } namespace inner2 { #ifdef BOOST_GET_POINTER_IN_BOOST } #endif template T* get_pointer2(inner2::X); #ifdef BOOST_GET_POINTER_IN_BOOST namespace inner2 { #endif } // Begin tests namespace inner2 { int x1 = boost::inner1::f(std::auto_ptr()); int x2 = boost::inner1::g(std::auto_ptr()); int x3 = boost::inner1::f((int*)0); int x4 = boost::inner1::g((int*)0); int x5 = boost::inner1::f((int*)0); int x6 = boost::inner1::g((int*)0); int x7 = boost::inner1::f(boost::inner2::X()); int x8 = boost::inner1::g(boost::inner2::X()); int y1 = user::f(std::auto_ptr()); int y3 = user::f((int*)0); int y5 = user::f((int*)0); int y7 = user::f(boost::inner2::X()); } namespace inner1 { int x1 = boost::inner1::f(std::auto_ptr()); int x2 = boost::inner1::g(std::auto_ptr()); int x3 = boost::inner1::f((int*)0); int x4 = boost::inner1::g((int*)0); int x5 = boost::inner1::f((int*)0); int x6 = boost::inner1::g((int*)0); int x7 = boost::inner1::f(boost::inner2::X()); int x8 = boost::inner1::g(boost::inner2::X()); int y1 = user::f(std::auto_ptr()); int y3 = user::f((int*)0); int y5 = user::f((int*)0); int y7 = user::f(boost::inner2::X()); } int x1 = boost::inner1::f(std::auto_ptr()); int x2 = boost::inner1::g(std::auto_ptr()); int x3 = boost::inner1::f((int*)0); int x4 = boost::inner1::g((int*)0); int x5 = boost::inner1::f((int*)0); int x6 = boost::inner1::g((int*)0); int x7 = boost::inner1::f(boost::inner2::X()); int x8 = boost::inner1::g(boost::inner2::X()); int y1 = user::f(std::auto_ptr()); int y3 = user::f((int*)0); int y5 = user::f((int*)0); int y7 = user::f(boost::inner2::X()); } namespace other { int x1 = boost::inner1::f(std::auto_ptr()); int x2 = boost::inner1::g(std::auto_ptr()); int x3 = boost::inner1::f((int*)0); int x4 = boost::inner1::g((int*)0); int x5 = boost::inner1::f((int*)0); int x6 = boost::inner1::g((int*)0); int x7 = boost::inner1::f(boost::inner2::X()); int x8 = boost::inner1::g(boost::inner2::X()); int y1 = user::f(std::auto_ptr()); int y3 = user::f((int*)0); int y5 = user::f((int*)0); int y7 = user::f(boost::inner2::X()); }