Boost C++ Libraries: Ticket #10778: VC14 CTP4 Atomic don't compile with boost::chrono durations which are not TriviallyCopyable https://svn.boost.org/trac10/ticket/10778 <p> This complete example does not compile in VC14 CTP4: </p> <pre class="wiki"> #include &lt;atomic&gt; #include &lt;boost/chrono.hpp&gt; std::atomic&lt;boost::chrono::milliseconds&gt; ms; // error C2338: atomic&lt;T&gt; requires T to be trivially copyable. </pre><p> Using the standard library instead works as expected: </p> <pre class="wiki"> #include &lt;atomic&gt; #include &lt;chrono&gt; std::atomic&lt;std::chrono::milliseconds&gt; ms; // no error </pre><p> The compiler is correct that boost::chrono::duration is not trivially copyable (as described on cppreference.com at least) but it seems (from looking at the code) that it's mostly concept check code used in constructors definitions that trigger the problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10778 Trac 1.4.3 raad@… Mon, 10 Nov 2014 10:30:19 GMT cc set https://svn.boost.org/trac10/ticket/10778#comment:1 https://svn.boost.org/trac10/ticket/10778#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">raad@…</span> added </li> </ul> Ticket viboes Tue, 11 Nov 2014 14:49:11 GMT <link>https://svn.boost.org/trac10/ticket/10778#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10778#comment:2</guid> <description> <p> The problem is at least on the default constructor. </p> <p> I added the default initialization as zero, but this is not correct. </p> <p> Please, could you try the following </p> <pre class="wiki">#if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS BOOST_FORCEINLINE BOOST_CONSTEXPR duration() : rep_(duration_values&lt;rep&gt;::zero()) { } #else duration() BOOST_NOEXCEPT = default; #endif </pre><p> You would surely need </p> <pre class="wiki">#if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS duration&amp; operator=(const duration&amp; rhs) // = default; { if (&amp;rhs != this) rep_= rhs.rep_; return *this; } #else duration&amp; operator=(const duration&amp; rhs) = default; #endif </pre> </description> <category>Ticket</category> </item> <item> <author>mjklaim@…</author> <pubDate>Thu, 13 Nov 2014 23:03:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10778#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10778#comment:3</guid> <description> <p> First: I uninstalled VC14 CTP4 and installed VS2015 Preview, which is the same compiler (certainly with some bugfixes). As expected I found the same issue. </p> <p> Second: I applied your changes and now it compiles (it required both changes). </p> <p> I will now re-compile my boost binaries with this change, see if there is any issue but I highly doubt it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 05 Dec 2014 18:33:12 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/10778#comment:4 https://svn.boost.org/trac10/ticket/10778#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> <p> Any news? <a class="ext-link" href="https://github.com/boostorg/chrono/commit/6faac3febb4e70b9f9a980d14340a37a5d7432d1"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/6faac3febb4e70b9f9a980d14340a37a5d7432d1</a> <a class="ext-link" href="https://github.com/boostorg/chrono/commit/9885be7ec0ba5b867b0f6245de3422905ebf6b4a"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/9885be7ec0ba5b867b0f6245de3422905ebf6b4a</a> </p> Ticket mjklaim@… Fri, 05 Dec 2014 18:38:14 GMT <link>https://svn.boost.org/trac10/ticket/10778#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10778#comment:5</guid> <description> <p> I had no apparent problem with the build I was talking about so I think it works in principle, but I didn't see your patches. I can't test these patches until next week. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 07 Jan 2015 02:35:43 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10778#comment:6 https://svn.boost.org/trac10/ticket/10778#comment:6 <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> Ticket