[Boost-bugs] [Boost C++ Libraries] #7474: compilation error in boost::serialization

Subject: [Boost-bugs] [Boost C++ Libraries] #7474: compilation error in boost::serialization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-06 00:15:00


#7474: compilation error in boost::serialization
-------------------------------------------+--------------------------------
 Reporter: Like Gao <gao.like@…> | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost Release Branch | Severity: Problem
 Keywords: |
-------------------------------------------+--------------------------------
 Error: passing 'const ... discards qualifiers'

 Related File: /opt/local/include/boost/serialization/split_member.hpp

 Root cause:
 In /opt/local/include/boost/serialization/split_member.hpp:
 calling access::member_save() with a "const & T"
 {{{
     template<class Archive, class T>
     struct member_saver {
         static void invoke(
             Archive & ar,
             const T & t,
             const unsigned int file_version
         ){
                 access::member_save(ar, t, file_version);
                                                        ^^ t is "const T&"
         }
     };
 }}}
 But in the called, parameter t is not expecting "const".
 See file /opt/local/include/boost/serialization/access.hpp:
 {{{
     // pass calls to users's class implementation
     template<class Archive, class T>
     static void member_save(
         Archive & ar,
         //const T & t,
         T & t,
         const unsigned int file_version
     ){
         t.save(ar, file_version);
     }
 }}}


 Error trace:
 * Invoking: GCC C++ Compiler
 * g++ -DOS_MACOSX -I/opt/local/gtest/include
 -I../third_party/leveldb-1.5.0/include -I../third_party/leveldb-1.5.0
 -I/opt/local/include -I../src/server/cse -O0 -g3 -Wall -c -fmessage-
 length=0 -MMD -MP -MF"test/server/cse/bucket_addcells.d"
 -MT"test/server/cse/bucket_addcells.d" -o
 "test/server/cse/bucket_addcells.o"
 "../test/server/cse/bucket_addcells.cpp"
 * /opt/local/include/boost/serialization/access.hpp: In static member
 function 'static void boost::serialization::access::member_save(Archive&,
 T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = const
 cse::SortedBucket<int, float>]':
 * /opt/local/include/boost/serialization/split_member.hpp:43:
 instantiated from 'static void
 boost::serialization::detail::member_saver<Archive, T>::invoke(Archive&,
 const T&, unsigned int) [with Archive = boost::archive::text_oarchive, T =
 cse::SortedBucket<int, float>]'
 * /opt/local/include/boost/serialization/split_member.hpp:70:
 instantiated from 'void boost::serialization::split_member(Archive&, T&,
 unsigned int) [with Archive = boost::archive::text_oarchive, T =
 cse::SortedBucket<int, float>]'
 * ../src/server/cse/io/sorted.hpp:56: instantiated from 'void
 cse::SortedBucket<KEY, VAL>::serialize(Archive&, unsigned int) [with
 Archive = boost::archive::text_oarchive, KEY = int, VAL = float]'
 * /opt/local/include/boost/serialization/access.hpp:118: instantiated
 from 'static void boost::serialization::access::serialize(Archive&, T&,
 unsigned int) [with Archive = boost::archive::text_oarchive, T =
 cse::SortedBucket<int, float>]'
 * /opt/local/include/boost/serialization/serialization.hpp:69:
 instantiated from 'void boost::serialization::serialize(Archive&, T&,
 unsigned int) [with Archive = boost::archive::text_oarchive, T =
 cse::SortedBucket<int, float>]'
 * /opt/local/include/boost/serialization/serialization.hpp:128:
 instantiated from 'void boost::serialization::serialize_adl(Archive&, T&,
 unsigned int) [with Archive = boost::archive::text_oarchive, T =
 cse::SortedBucket<int, float>]'
 * /opt/local/include/boost/archive/detail/oserializer.hpp:148:
 instantiated from 'void boost::archive::detail::oserializer<Archive,
 T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*)
 const [with Archive = boost::archive::text_oarchive, T =
 cse::SortedBucket<int, float>]' ../test/server/cse/bucket_addcells.cpp:63:
 instantiated from here
 * /opt/local/include/boost/serialization/access.hpp:93: error: passing
 'const cse::SortedBucket<int, float>' as 'this' argument of 'void
 cse::SortedBucket<KEY, VAL>::save(Archive&, unsigned int) [with Archive =
 boost::archive::text_oarchive, KEY = int, VAL = float]' discards
 qualifiers

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7474>
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:10 UTC