[Boost-bugs] [Boost C++ Libraries] #7850: polymorphic_iarchive_route.hpp: declaration of 'is' shadows a member of 'this'

Subject: [Boost-bugs] [Boost C++ Libraries] #7850: polymorphic_iarchive_route.hpp: declaration of 'is' shadows a member of 'this'
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-04 16:05:37


#7850: polymorphic_iarchive_route.hpp: declaration of 'is' shadows a member of
'this'
-------------------------------------------------+--------------------------
 Reporter: Luc Perneel <l.perneel@…> | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: serialization polymorphic shadow |
-------------------------------------------------+--------------------------
 When compiling the demo application:
 ./libs/serialization/example/demo_polymorphic.cpp

 using gcc (in our case 3.4.3) with –Wall –Werror, this fails due to:

 . /boost/archive/polymorphic_text_iarchive.hpp:37: instantiated from
 here
 ./boost/archive/detail/polymorphic_iarchive_route.hpp:199: warning:
 declaration of 'is' shadows a member of 'this'

 I checked this in the latest release (aka 1.52) and error is still in:

 It is caused by the definition in:

 http://www.boost.org/doc/libs/1_52_0/boost/archive/basic_text_iprimitive.hpp
 :

 {{{
 template<class IStream>
 class basic_text_iprimitive
 {
 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 protected:
 #else
 public:
 #endif
     IStream &is;
     io::ios_flags_saver flags_saver;
 }}}

 combined with the implementation in:
 http://www.boost.org/doc/libs/1_52_0/boost/archive/detail/polymorphic_iarchive_route.hpp
 :
 {{{
     // all current archives take a stream as constructor argument
     template <class _Elem, class _Tr>
     polymorphic_iarchive_route(
         std::basic_istream<_Elem, _Tr> & is,
         unsigned int flags = 0
     ) :
         ArchiveImplementation(is, flags)
     {}
     virtual ~polymorphic_iarchive_route(){};
 }}}

 As you can see: in the basic_test_iprimitive, “is” is a member (aka
 IStream) while in polymorphic_iarchive_route.hpp it is an argument in
 ArchiveImplementation

 I fixed it in our case by replacing the “is” in the argument case with
 â€œis_arg”:
 {{{
     // all current archives take a stream as constructor argument
     template <class _Elem, class _Tr>
     polymorphic_iarchive_route(
         std::basic_istream<_Elem, _Tr> & is_arg,
         unsigned int flags = 0
     ) :
         ArchiveImplementation(is_arg, flags)
     {}
     virtual ~polymorphic_iarchive_route(){};
 }}}

 Best Regards,
 Luc

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7850>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC