[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


================
@@ -2643,6 +2643,13 @@ class Sema final : public SemaBase {
            isConstantEvaluatedOverride;
   }
 
+  /// Set only around the compiler-synthesized whole-object memcpy for a
+  /// defaulted union copy/move assignment.  While set, CheckMemaccessArguments
+  /// skips the non-trivially-copyable record warning (warn_cxxstruct_memaccess)
+  /// for that one call, whose arguments are known correct.  It does not affect
+  /// any other memaccess check or any user code.
+  bool SuppressMemaccessCheck = false;
----------------
erichkeane wrote:

I don't like using a variable like this... This is only to disable the runtime check for this code?  It also probably isn't enough, since it is only skipping a single category of checks, and only in 1 place.  I think this isn't a very sound change.

https://github.com/llvm/llvm-project/pull/206579


More information about the cfe-commits mailing list