[Bug libstdc++/46821] New: swapping empty classes
marc.glisse at normalesup dot org
gcc-bugzilla@gcc.gnu.org
Mon Dec 6 13:20:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46821
Summary: swapping empty classes
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: marc.glisse@normalesup.org
Hello,
I noticed in the implementation of std::tuple that when a type is empty, swap
is implemented as:
void
_M_swap_impl(_Head&) { /* no-op */ }
and was wondering whether that was safe. Can't an empty type have copy, move,
assignment or swap with a non-trivial semantic? The object still has a unique
address, it could register it (in constructors) in a global data structure for
instance, and have assignment and swap change things in that data structure.
More information about the Gcc-bugs
mailing list