https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111299
Jiang An <de34 at live dot cn> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |de34 at live dot cn --- Comment #1 from Jiang An <de34 at live dot cn> --- > What ends up happening is that in order to bind x.value to the reference > parameter R&& r, we can't actually do that, so instead we create a temporary > initialized by copying x.value and we bind a reference to that temporary, > returning a Span pointing to... that. This looks like miscompilation. [[gnu::packed]] should have no effect here. Clang seemingly correctly compiles the function (https://godbolt.org/z/7x8fGcEM9).