This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does std::atomic< std::shared_ptr<string> > compile?


On 5 March 2015 at 23:06, Maik Zumstrull wrote:
> Does, in fact, compile on gcc 4.9.2 (Fedora). However, based on
> http://en.cppreference.com/w/cpp/atomic/atomic I would expect this to
> error out, since std::shared_ptr is surely not TriviallyCopyable. Can

Violating the precondition is undefined behaviour, so there's no
guarantee it will fail to compile.


> somebody in the know (jwakely?) comment whether this is supposed to
> compile, and would work as implied?

Anyway, with current trunk it fails:
/home/jwakely/gcc/5/include/c++/5.0.0/atomic:170:7: error: static
assertion failed: std::atomic requires a trivially copyable type

That wasn't possible previously because we didn't support the
is_trivially_copyable trait.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]