[Bug libstdc++/89164] New: can construct vector with non-copyable-but-trivially-copyable elements
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Feb 3 00:19:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89164
Bug ID: 89164
Summary: can construct vector with
non-copyable-but-trivially-copyable elements
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Consider (from https://stackoverflow.com/q/54498610/2069064):
#include <vector>
struct X {
X() = default;
X(const X&) = delete;
};
std::vector<X> v{X{}};
X is trivially copyable, but it isn't actually copy constructible... as a
result X isn't Cpp17EmplaceConstructible into std::vector<X> right? libstdc++
just emits a memmove anyway.
libc++ rejects this.
More information about the Gcc-bugs
mailing list