Subject: [Boost-bugs] [Boost C++ Libraries] #11330: boost::chrono::duration default constructor doesn't initialize rep_
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-21 18:50:19
#11330: boost::chrono::duration default constructor doesn't initialize rep_
--------------------------------+------------------------
Reporter: florent.castelli@⦠| Owner: viboes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: chrono
Version: Boost 1.58.0 | Severity: Regression
Keywords: |
--------------------------------+------------------------
According to the documentation:
{{{
constexpr duration();
Effects: Constructs an object of type duration from
duration_values<rep>::zero().
}}}
The implementation is:
{{{
#if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
BOOST_FORCEINLINE BOOST_CONSTEXPR
duration() : rep_(duration_values<rep>::zero()) { }
#else
BOOST_CONSTEXPR duration() BOOST_NOEXCEPT {};
#endif
}}}
So in one side is does initialise to zero, not in the other side. This is
a breaking change triggering tons of MSan issues in my application (and
certainly bugs in real applications).
Setting rep_ to zero() as it is done above fixes the issue for me.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11330> 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