From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-11-22 05:22:55
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 declaration
> > >> 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,
> > > right?
> > >
> > > 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 name-hiding
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!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk