Opened 8 years ago
Closed 8 years ago
#10778 closed Bugs (fixed)
VC14 CTP4 Atomic don't compile with boost::chrono durations which are not TriviallyCopyable
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.58.0 | Component: | chrono |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | Cc: | raad@… |
Description
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.
Change History (6)
comment:1 by , 8 years ago
Cc: | added |
---|
comment:2 by , 8 years ago
comment:3 by , 8 years ago
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.
Second: I applied your changes and now it compiles (it required both changes).
I will now re-compile my boost binaries with this change, see if there is any issue but I highly doubt it.
comment:4 by , 8 years ago
Milestone: | To Be Determined → Boost 1.58.0 |
---|
comment:5 by , 8 years ago
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.
comment:6 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The problem is at least on the default constructor.
I added the default initialization as zero, but this is not correct.
Please, could you try the following
You would surely need