public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/67572] std::atomic, std::mutex and others are trivially copyable
  2015-09-14 12:03 [Bug libstdc++/67572] New: std::atomic, std::mutex and others are trivially copyable redi at gcc dot gnu.org
@ 2015-09-14 12:03 ` redi at gcc dot gnu.org
  2015-09-15 14:57 ` jason at gcc dot gnu.org
  2021-04-19 10:40 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-14 12:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67572

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-09-14
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/67572] New: std::atomic, std::mutex and others are trivially copyable
@ 2015-09-14 12:03 redi at gcc dot gnu.org
  2015-09-14 12:03 ` [Bug libstdc++/67572] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-14 12:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67572

            Bug ID: 67572
           Summary: std::atomic, std::mutex and others are trivially
                    copyable
           Product: gcc
           Version: 4.9.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <atomic>
#include <mutex>
#include <shared_mutex>
#include <type_traits>

static_assert( !std::is_trivially_copyable<std::atomic<int>>::value,
"atomic<int>" );
static_assert( !std::is_trivially_copyable<std::mutex>::value, "mutex" );
static_assert( !std::is_trivially_copyable<std::timed_mutex>::value,
"timed_mutex" );
static_assert( !std::is_trivially_copyable<std::shared_timed_mutex>::value,
"shared_timed_mutex" );

Being non-copyable and non-movable doesn't stop a type being non-trivially
copyable, so to ensure users don't think it's OK to memcpy these types we need
to fix them (e.g. by adding a user-defined destructor).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/67572] std::atomic, std::mutex and others are trivially copyable
  2015-09-14 12:03 [Bug libstdc++/67572] New: std::atomic, std::mutex and others are trivially copyable redi at gcc dot gnu.org
  2015-09-14 12:03 ` [Bug libstdc++/67572] " redi at gcc dot gnu.org
@ 2015-09-15 14:57 ` jason at gcc dot gnu.org
  2021-04-19 10:40 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2015-09-15 14:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67572

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
This is related to core issue 1928 and paper N4148.

I think that places that test is_trivially_copyable should also check the
appropriate one of is_{copy,move}_{constructible,assignable}, since triviality
and callability are disjoint properties.

I also think that a class with no non-deleted copy/move ctor/op= shouldn't be
trivially copyable.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/67572] std::atomic, std::mutex and others are trivially copyable
  2015-09-14 12:03 [Bug libstdc++/67572] New: std::atomic, std::mutex and others are trivially copyable redi at gcc dot gnu.org
  2015-09-14 12:03 ` [Bug libstdc++/67572] " redi at gcc dot gnu.org
  2015-09-15 14:57 ` jason at gcc dot gnu.org
@ 2021-04-19 10:40 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67572

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|redi at gcc dot gnu.org            |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-19 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 12:03 [Bug libstdc++/67572] New: std::atomic, std::mutex and others are trivially copyable redi at gcc dot gnu.org
2015-09-14 12:03 ` [Bug libstdc++/67572] " redi at gcc dot gnu.org
2015-09-15 14:57 ` jason at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).