diff -Nur boost-1.34-old/boost/none.hpp boost-1.34-new/boost/none.hpp --- boost-1.34-old/boost/none.hpp 2007-04-04 10:26:18.000000000 +0100 +++ boost-1.34-new/boost/none.hpp 2007-04-04 10:25:25.000000000 +0100 @@ -12,23 +12,11 @@ #ifndef BOOST_NONE_17SEP2003_HPP #define BOOST_NONE_17SEP2003_HPP -#include +#include "boost/none_t.hpp" namespace boost { -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) - -namespace detail { struct none_helper{}; } - -typedef int detail::none_helper::*none_t ; - -none_t const none = ((none_t)0) ; - -#else - -enum none_t {none = 0}; - -#endif +inline int none(detail::none_helper) { return 0; } } // namespace boost diff -Nur boost-1.34-old/boost/none_t.hpp boost-1.34-new/boost/none_t.hpp --- boost-1.34-old/boost/none_t.hpp 1970-01-01 01:00:00.000000000 +0100 +++ boost-1.34-new/boost/none_t.hpp 2007-04-04 10:25:25.000000000 +0100 @@ -0,0 +1,24 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/lib/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_NONE_T_17SEP2003_HPP +#define BOOST_NONE_T_17SEP2003_HPP + +namespace boost { + +namespace detail { struct none_helper{}; } + +typedef int (*none_t)(detail::none_helper); + +} // namespace boost + +#endif + diff -Nur boost-1.34-old/libs/optional/test/optional_test.cpp boost-1.34-new/libs/optional/test/optional_test.cpp --- boost-1.34-old/libs/optional/test/optional_test.cpp 2007-04-04 10:26:53.000000000 +0100 +++ boost-1.34-new/libs/optional/test/optional_test.cpp 2007-04-04 10:25:25.000000000 +0100 @@ -876,6 +876,20 @@ BOOST_CHECK ( eat(def) == 0 ) ; } +int eat2 ( char ) { return 0 ; } +int eat2 ( int ) { return 0 ; } +int eat2 ( void const* ) { return 0 ; } +int eat2 ( optional const& ) { return 1 ; } + +// +// This verifies that boost::none binds preferentially to optional +void test_none_binding() +{ + TRACE( std::endl << BOOST_CURRENT_FUNCTION ); + + BOOST_CHECK ( eat2(boost::none) == 1 ); +} + void test_no_implicit_conversions() { TRACE( std::endl << BOOST_CURRENT_FUNCTION ); @@ -936,6 +950,7 @@ test_no_implicit_conversions(); test_conversions1(); test_conversions2(); + test_none_binding(); } catch ( ... ) {