|
Boost Testing : |
From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2004-10-27 04:18:59
Robert Ramey wrote:
> I noticed the compiler warnings every time serializaton is invoked by the
> tests. I would be curious to know what we have to do to correct/suppress
> these. With other compilers I had to carefully adjust code which passes
> references in order to avoid some non-obvious C++ pitfalls in this area. So
> it wouldn't suprise me that we need one more tiny tweak for this compiler.
> Of course, I can't do that from here.
I tried to analyse we the compiler issues the warning. The last two items
of the instantiation stack look like this:
cxx: Warning: /vol1/tmp/boost/boost/boost/archive/detail/oserializer.hpp,
line 506: #461-D
initial value of reference to non-const must be an lvalue
detected during:
instantiation of "void
boost::archive::detail::save_array_type<Archive,
T>::invoke(Archive &, const T &) [with
Archive=boost::archive::binary_oarchive, T=const A
[10]]"
at line 551
---%<---
template<class Archive, class T>
inline void save(Archive & ar, const T &t){
typedef
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer<T>,
mpl::identity<detail::save_pointer_type<Archive, T> >,
//else
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum<T>,
mpl::identity<detail::save_enum_type<Archive, T> >,
//else
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array<T>,
mpl::identity<detail::save_array_type<Archive, T> >,
//else
mpl::identity<detail::save_non_pointer_type<Archive, T> >
>
>
>::type typex;
typex::invoke(ar, t); // <- *** 551 ***
}
--->%---
instantiation of "void boost::archive::save(Archive &, const T &)
[with Archive=boost::archive::binary_oarchive, T=const A
[10]]" at line 68 of
"/vol1/tmp/boost/boost/boost/archive/basic_binary_oarchiv
e.hpp"
---<%---
void save_override(const T & t, BOOST_PFTO int)
{
archive::save(* this->This(), t); // <- *** 68 ***
}
--->%---
The only explanation I can come up with is that "*this->This()" creates a
temporary which is then passed to "invoke(ar, t)". Does that make sense?
Markus