https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111299

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jiang An from comment #1)
> > 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).

No, [[gnu::packed]] means you cannot bind a full reference to an element of
that struct because it would be miscompiled.

clang actually miscompiles this because then the alignment for the refernece
would be incorrect ...

Reply via email to