Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#5322 closed Bugs (fixed)

Explicit default constructed chrono::durations are uninitialized

Reported by: Joachim Faulhaber Owned by: viboes
Milestone: Boost 1.47.0 Component: chrono
Version: Boost Development Trunk Severity: Problem
Keywords: chrono duration default constructor Cc:

Description

For boost::chrono::durations the default constructor is supposed to work like this:

typedef std::chrono::duration<int> D;
D d1;       // d1.count() uninitialized
D d2 = D(); // d2.count() zero-initialized

In the current implementation, durations d1 and d2 are uninitialized. Yet d2 should be initialized by zero.

Change History (3)

comment:1 by viboes, 12 years ago

Resolution: fixed
Status: newclosed

Hi,

I don't remember when I committed a fix, but the code now is

duration() : rep_(duration_values<rep>::zero()) { }

Please reopen the ticket if you have any issues yet.

comment:2 by viboes, 12 years ago

I have just found it, It was fixed by Changeset #70074

comment:3 by viboes, 11 years ago

Milestone: To Be DeterminedBoost 1.47.0
Note: See TracTickets for help on using tickets.