
David Abrahams wrote:
I could have sworn that's not what I saw when I responded to your message, but it appears to be the case now. Also it really surprises me because I know msvc-7.1 does do ADL.
For the record, I just double-checked. msvc-7.1 doesn't /always/ have ADL failures when template arguments are involved. But still the following C++ program is rejected by msvc-7.1 (because of a link error), as it fails to do ADL in that particular case: //////////////////////////////////////////////// namespace standard_space { template <class T> void swap(T&, T&); template <class T, class U> struct pair; template <class T, class U> void swap(pair<T, U>&, pair<T, U>&); } namespace foo_space { struct foo {}; void swap(foo&, foo&) {}; } template <class T> void temp_fun() { T obj1, obj2; using standard_space::swap; swap(obj1, obj2); // msvc-7.1 fails to do ADL! } int main() { temp_fun<foo_space::foo>(); return 0; } //////////////////////////////////////////////// http://www.dinkumware.com/exam/ says (when selecting "VC v7.1/C++"): error LNK2019: unresolved external symbol "void __cdecl standard_space::swap<struct foo_space::foo> [...] referenced in function "void __cdecl temp_fun<struct foo_space::foo>(void)" This error appears to indicate that msvc-7.1 prefers to call standard_space::swap, instead of foo_space::swap, in that particular case. Which is very much like what's happening inside boost/utility/swap.hpp, when doing #include <algorithm> and "using std::swap". Fortunately, msvc-7.1 end-users can work around the issue by adding their own boost::swap overload, as we've discussed last Saturday. The first results of the "specialized_in_boost_and_other" test I added yesterday indicate that msvc-7.1 will select this overload, even when it's declared /after/ doing #include <boost/utility/swap.hpp> http://www.boost.org/development/tests/trunk/developer/utility-swap_.html Kind regards, Niels