[clang] [Clang][Sema] Synthesize a memcpy body for defaulted union assignment (PR #206579)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 28 06:39:46 PDT 2026
================
@@ -15005,6 +15015,14 @@ buildMemcpyForAssignmentOp(Sema &S, SourceLocation Loc, QualType T,
Expr *CallArgs[] = {
To, From, IntegerLiteral::Create(S.Context, Size, SizeType, Loc)
};
+
+ // The synthesized union whole-object copy is a memcpy of a possibly
+ // non-trivially-copyable record, which is correct here; skip the memaccess
+ // warning across just this call rather than casting the arguments to void*.
+ std::optional<llvm::SaveAndRestore<bool>> DisableMemaccessCheck;
----------------
erichkeane wrote:
This is a SUPER odd way to use this...
Why isn't this whole area just `llvm::SaveAndRestore<boo> DisableMemaccessCheck(S.SuppressMemaccessCheck, SuppressMemaccessWarning)`?
https://github.com/llvm/llvm-project/pull/206579
More information about the cfe-commits
mailing list