Files
Erich Keane 8b7dd15ad1 Fix memcpy-operator= generation with restrict parameters. (#194906)
The below issue (and #63884) both report that we reject (and also
assert, because the memcpy failed) the memcpy we're generating for a
restrict field of a type with an implicit copy constructor.

First, we shouldn't be rejecting it this late, IF we wanted to reject it
(I contend we do not), we should do it at the same time we reject
const-members/make this a deleted operator. Second, of course we
shouldn't fail.

This patch NOW works by just having us skip the premature 'memcpy'
optimization here. In the end, the memcpy is generally skipped by
`CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr` in the example
(as this is a trivial type), but this reverts it to using a 'for' loop
for restrict, as it does for const, and volatile qualified values.

We perhaps might think about doing this for address-spaces/ptr-auth, but
at the moment, this fixes restrict version.

Fixes: #37979
2026-04-30 07:42:57 -07:00
..