https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68350
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #9)
> - If the input and output type are the same size and both are trivially
> constructible, we can use memcpy.
Correction: they need to be the same type. We can't memcpy here:
struct A { };
struct B { B() = default; B(A) { do_stuff(); } };
void (A* f, A* l, B* out) {
std::uninitialized_copy(f, l, out);
}
Both types are trivially copyable, but using memcpy is only valid for a single
type.