Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11245: Deserialization with private constructor works in 1.57 not in 1.58
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-02 14:17:32
#11245: Deserialization with private constructor works in 1.57 not in 1.58
-------------------------------+---------------------------
Reporter: Thomas Aho | Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.58.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+---------------------------
Comment (by ramey):
Turns out that I've had to look into the serialization of std::vector due
to an unrelated issue. Here is what I found:
serialization of a type with a private constructor will fail if that
constructor needs to be called.
But that often doesn't happen:
a) on most common serialization the type is already created and just
"filled in" by the load.
b) when serialized through a pointer, the same type will fail as this
requires that a new instance be created.
c) An interesting case is std::vector
the manner of loading is dependent on the result of the
is_default_constructible type_trait. So I'd have to look at that again to
see the effect of a constructor being private.
This is even worse as the implementation of "is_default_constructible" is
buggy in some compilers, and in others its correct but marked as buggy by
boost/config.hpp.
Now that I know all this, I'm inclined to take another look. On one hand,
I'm tempted to also check the size of the vector, if it's already big
enough then I could just fill it in if it's not could fill in what I can
and append to the end. On the other hand, that would introduce non-
obvious quirky runtime behavior which I generally like to avoid. The
current system always works or always fails at compile time.
Feel free to think about this some more and get back to me. I'll leave
the ticket open for now.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11245#comment:2> 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:18 UTC