Boost logo

Boost :

Subject: [boost] VC14 CTP4 Atomic don't compile with boost::chrono durations which are not TriviallyCopyable
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2014-11-06 18:32:48


I was testing my code with VC14 and found this issue.
I'm just not sure what to do about it, should I consider it a bug of
Boost.Chrono or not?

This complete example does not compile in VC14 CTP4:

#include <atomic>
#include <boost/chrono.hpp>

std::atomic<boost::chrono::milliseconds> ms; // error C2338: atomic<T>
requires T to be trivially copyable.

Using the standard library instead works as expected:

#include <atomic>
#include <chrono>

std::atomic<std::chrono::milliseconds> ms; // no error

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.
So I'm not sure if it should be fixed or not or what to do with this info.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk