https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95609
--- Comment #8 from Niall Douglas <s_gccbugzilla at nedprod dot com> --- (In reply to Jonathan Wakely from comment #7) > (In reply to Niall Douglas from comment #0) > > I would assume that the ABI ship has sailed, as usual, but if libstdc++'s > > span<T> could instead have the layout: > > > > { > > T *p; > > size_t l; > > } > > > > ... then a span<byte> would be layout-compatible with struct iovec, > > No it won't, because iovec has a void* member, and span<byte> has a byte* > member, which makes them not layout-compatible. Similarly for span<const > char> or any other specialization of span. It is indeed a shame that the compiler won't optimise this appropriately without additional markup on the iovec structure: https://godbolt.org/z/cTo5xPxjE I can tell you that in LLFIO we simply reinterpret cast on those platforms where we know they'll be bit identical because a bunch of static asserts wouldn't have allowed compilation otherwise. Niall