================
@@ -3244,6 +3244,17 @@ static bool canUseCtorHoming(const CXXRecordDecl *RD) {
       RD->hasConstexprNonCopyMoveConstructor())
     return false;
 
+  // Skip this optimization if this type is standard-layout and is a member of
+  // some standard-layout union in this translation unit. Per the C++ spec, "it
+  // is permitted to inspect the common initial part of any of" the "common
+  // initial sequence" of distinct types in a standard-layout union. This
+  // exception to strict aliasing enables producing a reference to a type
+  // without ever having constructed that type.
+  //
+  // See: https://timsong-cpp.github.io/cppwp/n3337/class.mem#19
----------------
AaronBallman wrote:

```suggestion
  // See: https://wg21.link/class.mem#general-30
```

https://github.com/llvm/llvm-project/pull/221615
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to