Opened 10 years ago

Closed 10 years ago

#7850 closed Bugs (fixed)

polymorphic_iarchive_route.hpp: declaration of 'is' shadows a member of 'this'

Reported by: Luc Perneel <l.perneel@…> Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.52.0 Severity: Problem
Keywords: serialization polymorphic shadow Cc:

Description

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

Change History (1)

comment:1 by Robert Ramey, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.