Boost C++ Libraries: Ticket #5322: Explicit default constructed chrono::durations are uninitialized https://svn.boost.org/trac10/ticket/5322 <p> For <code>boost::chrono::durations</code> the default constructor is supposed to work like this: </p> <div class="wiki-code"><div class="code"><pre><span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">chrono</span><span class="o">::</span><span class="n">duration</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">D</span><span class="p">;</span> <span class="n">D</span> <span class="n">d1</span><span class="p">;</span> <span class="c1">// d1.count() uninitialized</span> <span class="n">D</span> <span class="n">d2</span> <span class="o">=</span> <span class="n">D</span><span class="p">();</span> <span class="c1">// d2.count() zero-initialized</span> </pre></div></div><p> In the current implementation, durations <code>d1</code> and <code>d2</code> are uninitialized. Yet <code>d2</code> should be initialized by zero. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5322 Trac 1.4.3 viboes Thu, 14 Apr 2011 20:26:47 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5322#comment:1 https://svn.boost.org/trac10/ticket/5322#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Hi, </p> <p> I don't remember when I committed a fix, but the code now is </p> <blockquote> <p> duration() : rep_(duration_values&lt;rep&gt;::zero()) { } </p> </blockquote> <p> Please reopen the ticket if you have any issues yet. </p> Ticket viboes Thu, 14 Apr 2011 20:33:45 GMT <link>https://svn.boost.org/trac10/ticket/5322#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5322#comment:2</guid> <description> <p> I have just found it, It was fixed by Changeset <a class="missing ticket">#70074</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 28 May 2011 07:31:07 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/5322#comment:3 https://svn.boost.org/trac10/ticket/5322#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> </ul> Ticket