Opened 14 years ago
Closed 14 years ago
#2551 closed Bugs (fixed)
date_time's embedded constrained_value uses uninitialized member
Reported by: | Owned by: | az_sw_dude | |
---|---|---|---|
Milestone: | Boost 1.38.0 | Component: | date_time |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | Cc: | spencer@… |
Description
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.
Attachments (1)
Change History (2)
by , 14 years ago
Attachment: | 50-date_time-constrained_value-uninitialized.diff added |
---|
comment:1 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Already fixed in trunk.