Subject: [Boost-bugs] [Boost C++ Libraries] #2551: date_time's embedded constrained_value uses uninitialized member
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-11-29 21:12:56
#2551: date_time's embedded constrained_value uses uninitialized member
--------------------------------------------------+-------------------------
Reporter: Brad Spencer <spencer_at_[hidden]> | Owner: az_sw_dude
Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: date_time
Version: Boost 1.37.0 | Severity: Problem
Keywords: |
--------------------------------------------------+-------------------------
At first I thought this was a spurious warning from gcc-4.3, but upon
further inspection, I agree that the constrained_value class that comes as
part of date_time is using its value_ member before initializing it when
constructed with an out-of-range value.
I checked what the unofficial Boost Constrained Value proposed library
does, and it seems to "initialize, then check". It's reality easy to
apply the same approach here (see the attached patch). There may be a
better approach overall, but this prevents value_'s value from being
passed to a function (even if that function "doesn't use" the value)
before it is initialized.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2551> 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:49:59 UTC