This is the mail archive of the
mailing list for the GCC project.
Re: Why does std::atomic< std::shared_ptr<string> > compile?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Maik Zumstrull <maik at zumstrull dot net>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Thu, 5 Mar 2015 23:29:19 +0000
- Subject: Re: Why does std::atomic< std::shared_ptr<string> > compile?
- Authentication-results: sourceware.org; auth=none
- References: <CAO=zWDJMmPD2sF9BCCnr=P1Sy_SzLGQTtfdWptCai_N6gc94EQ at mail dot gmail dot com>
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