
This code does have the name hiding.overload resolution issues still. Can you change the call to swap so you use "std::swap(t.x, t.y)" instead of the using declaration and "swap(t.x,t.y)". The following compiles for me: #include <algorithm> template<typename T> struct foo { T t; foo():t(0){} void swap(foo& x){swap(x);} void swap(foo& x) { std::swap(t,x.t); } }; template<typename T> void swap(foo<T>& x,foo<T>& y) { x.swap(y); } int main() { foo<int> x,y; x.swap(y); } -- Sean Perry Compiler Development IBM Canada Lab (905)-413-6031 (tie 313-6031), fax (905)-413-4839 Joaquín Mª López Muñoz <joaquin@tid.es> To Sent by: boost@lists.boost.org boost-bounces@lis cc ts.boost.org Subject [boost] 11/22/2007 01:28 Re:[config][vacpp8.0]BOOST_FUNCTION PM _SCOPE_USING_DECLARATION_BREAKS_ADL should be defined? Please respond to boost@lists.boost .org "K. Noel Belcourt" ha escrito:
On Nov 22, 2007, at 3:22 AM, Joaquín Mª López Muñoz wrote:
Noel, could you please try the following variation of the test snippet, which tries to mimic as closely as possible the structure of the failing code? Thank you!
Okay, here it is.
xlC fsudba3.cpp "fsudba3.cpp", line 12.10: 1540-0256 (S) A parameter of type "foo<int> &" cannot be initialized with an expression of type "int". "fsudba3.cpp", line 12.10: 1540-1205 (I) The error occurred while converting to parameter 1 of "foo<int>::swap(foo<int> &)". "fsudba3.cpp", line 9.8: 1540-0700 (I) The previous message was produced while processing "foo<int>::swap_(foo<int> &)". "fsudba3.cpp", line 8.21: 1540-0700 (I) The previous message was produced while processing "foo<int>::swap(foo<int> &)". "fsudba3.cpp", line 25.8: 1540-0700 (I) The previous message was produced while processing "main()".
Ok, so we've got a case again. John, let me re-ask you about what we should do regarding this compiler bug. For your reference, the offending code does not involve name hiding anymore: #include <algorithm> template<typename T> struct foo { T t; foo():t(0){} void swap(foo& x){swap_(x);} void swap_(foo& x) { using std::swap; swap(t,x.t); } }; template<typename T> void swap(foo<T>& x,foo<T>& y) { x.swap(y); } int main() { foo<int> x,y; x.swap(y); } Of course there's no big problem if it's decided that this shouldn't be covered by BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL, but I think the bug qualifies as a reasonable extension for the concept covered by the macro. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost