[swap] How to fix ADL barrier for XL, Intel, GCC, Sun and Como?

The boost::swap utility from Joseph Gauterin has an ADL barrier against infinite recursion or ambiguity, as recommended by Steven Watanabe and David Abrahams, last year at the mailing list: "Re: [boost] Koenig lookup swap." http://lists.boost.org/Archives/boost/2007/08/125938.php Last Friday I added "test_adl_barrier" to test this ADL barrier. Unfortunately it fails on many compilers, including XL (AIX), Intel (version 9 and 10), GCC, Sun and Como: http://www.boost.org/development/tests/trunk/developer/utility-swap_.html While I usually use MSVC, and for that specific compiler, the ADL barrier appears successful! Do you know how to fix the ADL barrier for the other compilers? I'm afraid we'll need to have #if BOOST_WORKAROUND statements in there... FYI, the boost::swap utility is at: http://svn.boost.org/svn/boost/trunk/boost/utility/swap.hpp The ADL barrier test is at: http://svn.boost.org/svn/boost/trunk/libs/utility/swap/test/test_adl_barrier... Kind regards, -- Niels Dekker http://www.xs4all.nl/~nd/dekkerware Scientific programmer at LKEB, Leiden University Medical Center

on Tue Jul 29 2008, "Niels Dekker - mail address until 2008-12-31" <nd_mail_address_valid_until_2008-12-31-AT-xs4all.nl> wrote:
The boost::swap utility from Joseph Gauterin has an ADL barrier against infinite recursion or ambiguity, as recommended by Steven Watanabe and David Abrahams, last year at the mailing list: "Re: [boost] Koenig lookup swap." http://lists.boost.org/Archives/boost/2007/08/125938.php
Last Friday I added "test_adl_barrier" to test this ADL barrier. Unfortunately it fails on many compilers, including XL (AIX), Intel (version 9 and 10), GCC, Sun and Como: http://www.boost.org/development/tests/trunk/developer/utility-swap_.html
While I usually use MSVC, and for that specific compiler, the ADL barrier appears successful! Do you know how to fix the ADL barrier for the other compilers? I'm afraid we'll need to have #if BOOST_WORKAROUND statements in there...
FYI, the boost::swap utility is at: http://svn.boost.org/svn/boost/trunk/boost/utility/swap.hpp
The ADL barrier test is at: http://svn.boost.org/svn/boost/trunk/libs/utility/swap/test/test_adl_barrier...
Try replacing the using declaration with a using directive in swap.hpp Appears to work for GCC. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Last Friday I added "test_adl_barrier" to test this ADL barrier. Unfortunately it fails on many compilers, including XL (AIX), Intel (version 9 and 10), GCC, Sun and Como: http://www.boost.org/development/tests/trunk/developer/utility-swap_.html
David Abrahams wrote:
Try replacing the using declaration with a using directive in swap.hpp Appears to work for GCC.
Thanks, Dave. Unfortunately for MSVC, most of the tests would be broken, when doing so! So I guess we would need to do an #if BOOST_WORKAROUND within swap.hpp, e.g., as follows: #if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) using swap_adl_barrier::swap; #else using namespace swap_adl_barrier; #endif Right? I only tested it on MSVC, because I don't have direct access to an up-to-date GCC compiler at the moment. Shall I just commit it and see how the regression goes? Kind regards, Niels

AMDG Niels Dekker - mail address until 2008-12-31 wrote:
Thanks, Dave. Unfortunately for MSVC, most of the tests would be broken, when doing so! So I guess we would need to do an #if BOOST_WORKAROUND within swap.hpp, e.g., as follows:
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) using swap_adl_barrier::swap; #else using namespace swap_adl_barrier; #endif
Right? I only tested it on MSVC, because I don't have direct access to an up-to-date GCC compiler at the moment. Shall I just commit it and see how the regression goes?
I'll run the tests on all the compilers I have available, (gcc-3.4.4, gcc-4.2.3, gcc-4.3.0, msvc-7.1, msvc-8.0, msvc-9.0, cw-8.0, cw-9.2, sun-5.9, como-4.3.10.1) In Christ, Steven Watanabe

on Tue Jul 29 2008, "Niels Dekker - mail address until 2008-12-31" <nd_mail_address_valid_until_2008-12-31-AT-xs4all.nl> wrote:
Last Friday I added "test_adl_barrier" to test this ADL barrier. Unfortunately it fails on many compilers, including XL (AIX), Intel (version 9 and 10), GCC, Sun and Como: http://www.boost.org/development/tests/trunk/developer/utility-swap_.html
David Abrahams wrote:
Try replacing the using declaration with a using directive in swap.hpp Appears to work for GCC.
Thanks, Dave. Unfortunately for MSVC, most of the tests would be broken, when doing so! So I guess we would need to do an #if BOOST_WORKAROUND within swap.hpp, e.g., as follows:
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) using swap_adl_barrier::swap; #else using namespace swap_adl_barrier; #endif
Right? I only tested it on MSVC, because I don't have direct access to an up-to-date GCC compiler at the moment. Shall I just commit it and see how the regression goes?
To the trunk, yeah, that seems right. I didn't have time to dig up the standard language on this. Steven, are you sure it was supposed to work with the using-declaration? Failing como tests make me suspicious. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

AMDG David Abrahams wrote:
Steven, are you sure it was supposed to work with the using-declaration?
I was wrong. I just looked it up. The using declaration isn't supposed to work. In Christ, Steven Watanabe

on Wed Jul 30 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
AMDG
David Abrahams wrote:
Steven, are you sure it was supposed to work with the using-declaration?
I was wrong. I just looked it up. The using declaration isn't supposed to work.
Yeah, IIRC ADL finds names brought in with using declarations but not via using directives. Thanks for verifying that. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Steven Watanabe wrote:
David Abrahams wrote:
Steven, are you sure it was supposed to work with the using-declaration?
I was wrong. I just looked it up. The using declaration isn't supposed to work.
David Abrahams wrote:
Yeah, IIRC ADL finds names brought in with using declarations but not via using directives.
So... is it worth reporting the compiler bug to Microsoft? Because MSVC suggested that the using-declaration would provide an ADL barrier. Until today, I considered it a "feature", not a bug! Kind regards, Niels

on Wed Jul 30 2008, "Niels Dekker - mail address until 2008-12-31" <nd_mail_address_valid_until_2008-12-31-AT-xs4all.nl> wrote:
So... is it worth reporting the compiler bug to Microsoft? Because MSVC suggested that the using-declaration would provide an ADL barrier. Until today, I considered it a "feature", not a bug!
All bugs are worth reporting. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Steven Watanabe wrote:
The using declaration isn't supposed to work.
So do you think it's safe to remove the swap_adl_barrier namespace from http://svn.boost.org/svn/boost/trunk/boost/utility/swap.hpp now? (See attached patch) I think it would make the code easier to read, especially now that we know that swap_adl_barrier isn't really working as an ADL barrier.
So... is it worth reporting the compiler bug to Microsoft? Because MSVC suggested that the using-declaration would provide an ADL barrier.
David Abrahams wrote:
All bugs are worth reporting.
There's quite a few ADL related bug reports already, at http://connect.microsoft.com/feedback/default.aspx?SiteID=210 I'll have a closer look later... Good night, Niels

AMDG Niels Dekker - mail address until 2008-12-31 wrote:
Steven Watanabe wrote:
The using declaration isn't supposed to work.
So do you think it's safe to remove the swap_adl_barrier namespace from http://svn.boost.org/svn/boost/trunk/boost/utility/swap.hpp now? (See attached patch)
Yes. As it doesn't do any good, it's better to remove it to avoid confusing people. In Christ, Steven Watanabe

So do you think it's safe to remove the swap_adl_barrier namespace from http://svn.boost.org/svn/boost/trunk/boost/utility/swap.hpp now?
Steven Watanabe wrote:
Yes. As it doesn't do any good, it's better to remove it to avoid confusing people.
Just committed :-) http://svn.boost.org/trac/boost/changeset/47920 Should we refer to your technique (making sure that std::swap is more specialized than boost::swap) as an "ADL barrier" as well? Or is a different term more appropriate? Is it a known C++ "idiom"? I'm asking because the term "barrier namespace" still needs to be replaced by something else, at two places within the documentation: http://svn.boost.org/svn/boost/trunk/libs/utility/swap.html http://svn.boost.org/svn/boost/trunk/libs/utility/swap/test/test_adl_barrier... Kind regards, Niels

AMDG Niels Dekker - mail address until 2008-12-31 wrote:
Should we refer to your technique (making sure that std::swap is more specialized than boost::swap) as an "ADL barrier" as well?
Decidedly not. It has nothing to do with ADL.
Or is a different term more appropriate? Is it a known C++ "idiom"?
I'm asking because the term "barrier namespace" still needs to be replaced by something else, at two places within the documentation: http://svn.boost.org/svn/boost/trunk/libs/utility/swap.html http://svn.boost.org/svn/boost/trunk/libs/utility/swap/test/test_adl_barrier...
Yeah. We need a better term, but I'm not quite sure what. In Christ, Steven Watanabe

The 'barrier' namespace is only referred to in the two places Niels listed: 'test_adl_barrier.cpp' tests that boost::swap isn't ambiguous when called on types declared in namespace boost - so we can rename it 'boost_type_ambiguity.cpp', or something similar. The comment inside the test file can be altered accordingly as well. 'swap.html' contains the phrase ''for the idea to use a barrier namespace, enabling the function to have the name 'swap' without introducing ambiguity or infinite recursion". We can just replace that with ''for the idea to make boost::swap less specialized than std::swap, thereby allowing the function to have the name 'swap' without introducing ambiguity." If nobody objects to the phrasing, I'll make the change later today. Joe.

Joseph Gauterin wrote:
The 'barrier' namespace is only referred to in the two places Niels listed:
'test_adl_barrier.cpp' tests that boost::swap isn't ambiguous when called on types declared in namespace boost - so we can rename it 'boost_type_ambiguity.cpp', or something similar. The comment inside the test file can be altered accordingly as well.
'swap.html' contains the phrase ''for the idea to use a barrier namespace, enabling the function to have the name 'swap' without introducing ambiguity or infinite recursion". We can just replace that with ''for the idea to make boost::swap less specialized than std::swap, thereby allowing the function to have the name 'swap' without introducing ambiguity."
If nobody objects to the phrasing, I'll make the change later today.
Your suggested file renaming and rephrasing look just fine to me. So please go ahead :-) Kind regards, Niels

David Abrahams wrote on July 30, 2008:
All bugs are worth reporting.
I finally reported that particular ADL bug to Microsoft. Thanks for your patience :-) Please have a look: "Using-declaration ("using std::swap") should not disable argument-dependent lookup" https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedba... Newsgroup discussion on this issue: "VC appears to disable argument-dependent lookup, when using std::swap" http://groups.google.com/group/microsoft.public.vc.language/browse_frm/threa... Kind regards, Niels

on Mon Dec 08 2008, "Niels Dekker - mail address until 2010-10-10" <niels_address_until_2010-10-10-AT-xs4all.nl> wrote:
David Abrahams wrote on July 30, 2008:
All bugs are worth reporting.
I finally reported that particular ADL bug to Microsoft. Thanks for your patience :-)
Thanks for your diligence! -- Dave Abrahams BoostPro Computing http://www.boostpro.com

AMDG Niels Dekker - mail address until 2008-12-31 wrote:
David Abrahams wrote:
Try replacing the using declaration with a using directive in swap.hpp Appears to work for GCC.
Thanks, Dave. Unfortunately for MSVC, most of the tests would be broken, when doing so!
It doesn't work at all here. See attached. Dave, what exactly did you try? In Christ, Steven Watanabe Steven@D3RTHVC1 /cygdrive/c/boost/trunk/libs/utility/swap/test $ bjam gcc-3.4.4 gcc-4.2.3 gcc-4.3.0 msvc-8.0express msvc-9.0express como-4.3.1 0.1beta2 test_adl_barrier warning: Graph library does not contain optional GraphML reader. note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the note: directories containing the Expat headers and libraries, respectively. warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. Building Boost.Regex with the optional Unicode/ICU support disabled. Please refer to the Boost.Regex documentation for more information (don't panic: this is a strictly optional feature). ...patience... ...found 775 targets... ...updating 24 targets... gcc.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\ gcc-3.4.4\debug\test_adl_barrier.o test_adl_barrier.cpp: In function `int test_main(int, char**)': test_adl_barrier.cpp:29: error: no matching function for call to `swap(boost::sw ap_test_class&, boost::swap_test_class&)' ../../../../boost/test/test_tools.hpp: In function `boost::test_tools::predicate _result boost::test_tools::tt_detail::equal_impl(const Left&, const Right&) [wit h Left = unsigned int, Right = int]': ../../../../boost/test/test_tools.hpp:560: instantiated from `boost::test_tool s::predicate_result boost::test_tools::tt_detail::equal_impl_frwd::call_impl(con st Left&, const Right&, mpl_::false_) const [with Left = unsigned int, Right = i nt]' ../../../../boost/test/test_tools.hpp:575: instantiated from `boost::test_tool s::predicate_result boost::test_tools::tt_detail::equal_impl_frwd::operator()(co nst Left&, const Right&) const [with Left = unsigned int, Right = int]' ../../../../boost/test/test_tools.hpp:523: instantiated from `bool boost::test _tools::tt_detail::check_frwd(Pred, const boost::unit_test::lazy_ostream&, boost ::test_tools::const_string, size_t, boost::test_tools::tt_detail::tool_level, bo ost::test_tools::tt_detail::check_type, const Arg0&, const char*, const Arg1&, c onst char*) [with Pred = boost::test_tools::tt_detail::equal_impl_frwd, Arg0 = u nsigned int, Arg1 = int]' test_adl_barrier.cpp:31: instantiated from here ../../../../boost/test/test_tools.hpp:536: warning: comparison between signed an d unsigned integer expressions "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -DBOOST_ALL_NO_LIB=1 - DBOOST_TEST_NO_AUTO_LINK=1 -I"..\..\..\.." -c -o "..\..\..\..\bin.v2\libs\utili ty\swap\test\test_adl_barrier.test\gcc-3.4.4\debug\test_adl_barrier.o" "test_adl _barrier.cpp" ...failed gcc.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_bar rier.test\gcc-3.4.4\debug\test_adl_barrier.o... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\gcc -3.4.4\debug>test_adl_barrier.exe for lack of <p..\..\..\..\bin.v2\libs\utility\ swap\test\test_adl_barrier.test\gcc-3.4.4\debug>test_adl_barrier.o... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\gcc -3.4.4\debug>test_adl_barrier.run for lack of <p..\..\..\..\bin.v2\libs\utility\ swap\test\test_adl_barrier.test\gcc-3.4.4\debug>test_adl_barrier.exe... gcc.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\ gcc-4.2.3\debug\test_adl_barrier.o test_adl_barrier.cpp: In function 'int test_main(int, char**)': test_adl_barrier.cpp:29: error: no matching function for call to 'swap(boost::sw ap_test_class&, boost::swap_test_class&)' ../../../../boost/test/test_tools.hpp: In function 'boost::test_tools::predicate _result boost::test_tools::tt_detail::equal_impl(const Left&, const Right&) [wit h Left = unsigned int, Right = int]': ../../../../boost/test/test_tools.hpp:560: instantiated from 'boost::test_tool s::predicate_result boost::test_tools::tt_detail::equal_impl_frwd::call_impl(con st Left&, const Right&, mpl_::false_) const [with Left = unsigned int, Right = i nt]' ../../../../boost/test/test_tools.hpp:575: instantiated from 'boost::test_tool s::predicate_result boost::test_tools::tt_detail::equal_impl_frwd::operator()(co nst Left&, const Right&) const [with Left = unsigned int, Right = int]' ../../../../boost/test/test_tools.hpp:523: instantiated from 'bool boost::test _tools::tt_detail::check_frwd(Pred, const boost::unit_test::lazy_ostream&, boost ::test_tools::const_string, size_t, boost::test_tools::tt_detail::tool_level, bo ost::test_tools::tt_detail::check_type, const Arg0&, const char*, const Arg1&, c onst char*) [with Pred = boost::test_tools::tt_detail::equal_impl_frwd, Arg0 = u nsigned int, Arg1 = int]' test_adl_barrier.cpp:31: instantiated from here ../../../../boost/test/test_tools.hpp:536: warning: comparison between signed an d unsigned integer expressions ../../../../boost/test/floating_point_comparison.hpp: At global scope: ../../../../boost/test/floating_point_comparison.hpp:224: warning: 'boost::test_ tools::<unnamed>::check_is_close' defined but not used ../../../../boost/test/floating_point_comparison.hpp:246: warning: 'boost::test_ tools::<unnamed>::check_is_small' defined but not used "g++-4.2.3" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -DBOOST_ALL_NO_L IB=1 -DBOOST_TEST_NO_AUTO_LINK=1 -I"..\..\..\.." -c -o "..\..\..\..\bin.v2\libs \utility\swap\test\test_adl_barrier.test\gcc-4.2.3\debug\test_adl_barrier.o" "te st_adl_barrier.cpp" ...failed gcc.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_bar rier.test\gcc-4.2.3\debug\test_adl_barrier.o... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\gcc -4.2.3\debug>test_adl_barrier.exe for lack of <p..\..\..\..\bin.v2\libs\utility\ swap\test\test_adl_barrier.test\gcc-4.2.3\debug>test_adl_barrier.o... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\gcc -4.2.3\debug>test_adl_barrier.run for lack of <p..\..\..\..\bin.v2\libs\utility\ swap\test\test_adl_barrier.test\gcc-4.2.3\debug>test_adl_barrier.exe... gcc.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\ gcc-4.3.0\debug\test_adl_barrier.o test_adl_barrier.cpp: In function 'int test_main(int, char**)': test_adl_barrier.cpp:29: error: no matching function for call to 'swap(boost::sw ap_test_class&, boost::swap_test_class&)' ..\..\..\../boost/test/test_tools.hpp: In function 'boost::test_tools::predicate _result boost::test_tools::tt_detail::equal_impl(const Left&, const Right&) [wit h Left = unsigned int, Right = int]': ..\..\..\../boost/test/test_tools.hpp:560: instantiated from 'boost::test_tool s::predicate_result boost::test_tools::tt_detail::equal_impl_frwd::call_impl(con st Left&, const Right&, mpl_::false_) const [with Left = unsigned int, Right = i nt]' ..\..\..\../boost/test/test_tools.hpp:575: instantiated from 'boost::test_tool s::predicate_result boost::test_tools::tt_detail::equal_impl_frwd::operator()(co nst Left&, const Right&) const [with Left = unsigned int, Right = int]' ..\..\..\../boost/test/test_tools.hpp:523: instantiated from 'bool boost::test _tools::tt_detail::check_frwd(Pred, const boost::unit_test::lazy_ostream&, boost ::test_tools::const_string, size_t, boost::test_tools::tt_detail::tool_level, bo ost::test_tools::tt_detail::check_type, const Arg0&, const char*, const Arg1&, c onst char*) [with Pred = boost::test_tools::tt_detail::equal_impl_frwd, Arg0 = u nsigned int, Arg1 = int]' test_adl_barrier.cpp:31: instantiated from here ..\..\..\../boost/test/test_tools.hpp:536: warning: comparison between signed an d unsigned integer expressions ..\..\..\../boost/test/floating_point_comparison.hpp: At global scope: ..\..\..\../boost/test/floating_point_comparison.hpp:224: warning: 'boost::test_ tools::<unnamed>::check_is_close' defined but not used ..\..\..\../boost/test/floating_point_comparison.hpp:246: warning: 'boost::test_ tools::<unnamed>::check_is_small' defined but not used "g++-4.3.0" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -DBOOST_ALL_NO_L IB=1 -DBOOST_TEST_NO_AUTO_LINK=1 -I"..\..\..\.." -c -o "..\..\..\..\bin.v2\libs \utility\swap\test\test_adl_barrier.test\gcc-4.3.0\debug\test_adl_barrier.o" "te st_adl_barrier.cpp" ...failed gcc.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_bar rier.test\gcc-4.3.0\debug\test_adl_barrier.o... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\gcc -4.3.0\debug>test_adl_barrier.exe for lack of <p..\..\..\..\bin.v2\libs\utility\ swap\test\test_adl_barrier.test\gcc-4.3.0\debug>test_adl_barrier.o... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\gcc -4.3.0\debug>test_adl_barrier.run for lack of <p..\..\..\..\bin.v2\libs\utility\ swap\test\test_adl_barrier.test\gcc-4.3.0\debug>test_adl_barrier.exe... compile-c-c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\ms vc-8.0express\debug\threading-multi\test_adl_barrier.obj test_adl_barrier.cpp test_adl_barrier.cpp(29) : error C2784: 'void boost::swap(boost::shared_ptr<T> & ,boost::shared_ptr<T> &)' : could not deduce template argument for 'boost::share d_ptr<T> &' from 'boost::swap_test_class' ..\..\..\..\boost/shared_ptr.hpp(568) : see declaration of 'boost::swap' test_adl_barrier.cpp(29) : error C2784: 'void boost::swap(boost::intrusive_ptr<T
&,boost::intrusive_ptr<T> &)' : could not deduce template argument for 'boost: :intrusive_ptr<T> &' from 'boost::swap_test_class' ..\..\..\..\boost/intrusive_ptr.hpp(243) : see declaration of 'boost::sw ap'
call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 >nul cl /Zm800 -nologo @"..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.t est\msvc-8.0express\debug\threading-multi\test_adl_barrier.obj.rsp" ...failed compile-c-c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barri er.test\msvc-8.0express\debug\threading-multi\test_adl_barrier.obj... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msv c-8.0express\debug\threading-multi>test_adl_barrier.exe for lack of <p..\..\..\. .\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msvc-8.0express\debug\thre ading-multi>test_adl_barrier.obj... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msv c-8.0express\debug\threading-multi>test_adl_barrier.run for lack of <p..\..\..\. .\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msvc-8.0express\debug\thre ading-multi>test_adl_barrier.exe... compile-c-c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\ms vc-9.0express\debug\threading-multi\test_adl_barrier.obj test_adl_barrier.cpp test_adl_barrier.cpp(29) : error C2784: 'void boost::swap(boost::shared_ptr<T> & ,boost::shared_ptr<T> &)' : could not deduce template argument for 'boost::share d_ptr<T> &' from 'boost::swap_test_class' c:\boost\trunk\boost/shared_ptr.hpp(568) : see declaration of 'boost::sw ap' test_adl_barrier.cpp(29) : error C2784: 'void boost::swap(boost::intrusive_ptr<T
&,boost::intrusive_ptr<T> &)' : could not deduce template argument for 'boost: :intrusive_ptr<T> &' from 'boost::swap_test_class' c:\boost\trunk\boost/intrusive_ptr.hpp(243) : see declaration of 'boost: :swap'
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 >nu l cl /Zm800 -nologo @"..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.t est\msvc-9.0express\debug\threading-multi\test_adl_barrier.obj.rsp" ...failed compile-c-c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barri er.test\msvc-9.0express\debug\threading-multi\test_adl_barrier.obj... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msv c-9.0express\debug\threading-multi>test_adl_barrier.exe for lack of <p..\..\..\. .\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msvc-9.0express\debug\thre ading-multi>test_adl_barrier.obj... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msv c-9.0express\debug\threading-multi>test_adl_barrier.run for lack of <p..\..\..\. .\bin.v2\libs\utility\swap\test\test_adl_barrier.test\msvc-9.0express\debug\thre ading-multi>test_adl_barrier.exe... como-win.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier. test\como-win-4.3.10.1beta2\debug\test_adl_barrier.obj Setting environment for using Microsoft Visual Studio 2008 x86 tools. "..\..\..\..\boost/test/utils/basic_cstring/basic_cstring.hpp", line 60: warning #68-D: integer conversion resulted in a change of sign enum npos_type { npos = (size_type)-1 }; ^ "test_adl_barrier.cpp", line 29: error #304: no instance of overloaded function "boost::swap" matches the argument list argument types are: (boost::swap_test_class, boost::swap_test_class ) boost::swap(object1,object2); ^ 1 error detected in the compilation of "test_adl_barrier.cpp". call "C:/Program Files/Comeau/xp43101beta2/bin/setup" como -c -e5 --no_version --no_prelink_verbose --display_error_number --long_lon g --diag_suppress=9,21,161,748,940,962 --diag_error=461 -D__STL_LONG_LONG -DBOO ST_ALL_NO_LIB=1 -DBOOST_TEST_NO_AUTO_LINK=1 --no_inlining -D_WIN32 --exceptions -I"..\..\..\.." -o "..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrie r.test\como-win-4.3.10.1beta2\debug\test_adl_barrier.obj" "test_adl_barrier.cpp" ...failed como-win.compile.c++ ..\..\..\..\bin.v2\libs\utility\swap\test\test_ad l_barrier.test\como-win-4.3.10.1beta2\debug\test_adl_barrier.obj... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\com o-win-4.3.10.1beta2\debug>test_adl_barrier.exe for lack of <p..\..\..\..\bin.v2\ libs\utility\swap\test\test_adl_barrier.test\como-win-4.3.10.1beta2\debug>test_a dl_barrier.obj... ...skipped <p..\..\..\..\bin.v2\libs\utility\swap\test\test_adl_barrier.test\com o-win-4.3.10.1beta2\debug>test_adl_barrier.run for lack of <p..\..\..\..\bin.v2\ libs\utility\swap\test\test_adl_barrier.test\como-win-4.3.10.1beta2\debug>test_a dl_barrier.exe... ...failed updating 6 targets... ...skipped 18 targets... Steven@D3RTHVC1 /cygdrive/c/boost/trunk/libs/utility/swap/test $

on Tue Jul 29 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
AMDG
Niels Dekker - mail address until 2008-12-31 wrote:
David Abrahams wrote:
Try replacing the using declaration with a using directive in swap.hpp Appears to work for GCC.
Thanks, Dave. Unfortunately for MSVC, most of the tests would be broken, when doing so!
It doesn't work at all here. See attached.
Dave, what exactly did you try?
This: -- Dave Abrahams BoostPro Computing http://www.boostpro.com

AMDG David Abrahams wrote:
Dave, what exactly did you try?
This:
With a minor change it doesn't work anymore. (In fact #include <boost/test/test_tools.hpp> is enough to make it fail.) In Christ, Steven Watanabe

on Tue Jul 29 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
AMDG
David Abrahams wrote:
Dave, what exactly did you try?
This:
With a minor change it doesn't work anymore. (In fact #include <boost/test/test_tools.hpp> is enough to make it fail.)
Seems to me that if this is failing on so many compilers, our only practical alternative is to call boost::swap something other than swap. How about swap_()? -- Dave Abrahams BoostPro Computing http://www.boostpro.com

AMDG David Abrahams wrote:
Seems to me that if this is failing on so many compilers, our only practical alternative is to call boost::swap something other than swap. How about swap_()?
I have a fix: Make sure that std::swap is more specialized than boost::swap. In Christ, Steven Watanabe

on Tue Jul 29 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
AMDG
David Abrahams wrote:
Seems to me that if this is failing on so many compilers, our only practical alternative is to call boost::swap something other than swap. How about swap_()?
I have a fix: Make sure that std::swap is more specialized than boost::swap.
Ingenious; that should work.
In Christ, Steven Watanabe
Index: swap.hpp =================================================================== --- swap.hpp (revision 47858) +++ swap.hpp (working copy) @@ -38,8 +38,8 @@ { namespace swap_adl_barrier { - template<class T> - void swap(T& left, T& right) + template<class T1, class T2> + void swap(T1& left, T2& right) { ::boost_swap_impl::swap_impl(left, right); } _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Dave Abrahams BoostPro Computing http://www.boostpro.com

AMDG David Abrahams wrote:
I have a fix: Make sure that std::swap is more specialized than boost::swap.
Ingenious; that should work.
I just finished testing locally. It works on all the compilers I have. In Christ, Steven Watanabe

Steven Watanabe wrote:
I just finished testing locally. It works on all the compilers I have.
I'm impressed! Thanks a lot, Steve! I've just committed your patch to the trunk: http://svn.boost.org/trac/boost/changeset/47877 Kind regards, Niels

Thank David, Neild and Steven. That fix really was ingenious. Joe. On Wed, Jul 30, 2008 at 9:06 AM, Niels Dekker - mail address until 2008-12-31 <nd_mail_address_valid_until_2008-12-31@xs4all.nl> wrote:
Steven Watanabe wrote:
I just finished testing locally. It works on all the compilers I have.
I'm impressed! Thanks a lot, Steve!
I've just committed your patch to the trunk: http://svn.boost.org/trac/boost/changeset/47877
Kind regards, Niels _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (5)
-
David Abrahams
-
Joseph Gauterin
-
Niels Dekker - mail address until 2008-12-31
-
Niels Dekker - mail address until 2010-10-10
-
Steven Watanabe