From: K. Noel Belcourt (kbelco_at_[hidden])
Date: 2007-11-22 13:02:32
On Nov 22, 2007, at 3:22 AM, Joaquín Mª López Muñoz wrote:
> Joaquín Mª López Muñoz ha escrito:
>> "K. Noel Belcourt" ha escrito:
>>> On Nov 16, 2007, at 5:10 AM, Joaquín Mª López Muñoz wrote:
>>>> John Maddock ha escrito:
>>>>> In foo::swap the local declaration of the member function "swap"
>>>>> hides any occurances of swap in the outer scope, and the using
>>>>> behaves "as if" std::swap were imported into the *enclosing
>>>>> namespace*, which
>>>>> would still be hidden... and yet I can't believe that this
>>>>> simple idiom
>>>>> isn't actually legal ! :-) And indeed all the other compilers
>>>>> I tested
>>>>> do compile this OK.
>>>> Ouch, didn't think about name hiding... this is why I love C++ :-/
>>>> Now I don't know either whether the code is legal or not. Anyway,
>>>> if I changed foo::swap to foo::swop the code would be
>>>> undoubtedly legal then,
>>>> Noel, would you please try the attached variation?
>>> Compiles fine with vacpp-8.0, no errors or warnings.
>> Ok, thanks for your help! I think I'll change then my code to
>> avoid the name hiding
>> thing, hopefully you'll see multi_index tests go green for
>> vacpp-8.0 in the next
> I changed some code inside Boost.MultiIndex so as to move the using
> std::swap decl
> out of the name-hiding scope (http://svn.boost.org/trac/boost/
> changeset/41220 )
> but the error happens the same (http://tinyurl.com/256p2t ). So I
> guess there
> are still cases where the compiler handles this wrong even if no
> problems are present.
> 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()".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk