[clang] [clang] Respect field alignment in layout compatibility of structs (PR #84313)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 12:46:54 PST 2024


================
@@ -19185,7 +19185,7 @@ static bool isLayoutCompatible(ASTContext &C, EnumDecl *ED1, EnumDecl *ED2) {
 
 /// Check if two fields are layout-compatible.
----------------
Endilll wrote:

Good catch! CWG2586 I implement here basically establish a different set of rules for layout compatibility of union members, and structs/classes are not layout compatible with unions by definition.

At this point I wonder if boolean is still needed, but my impression of our layout compatibility machinery is that it might be a bit too smart to infer the boolean. It's simple and recursive, without "looking back" so to say.

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


More information about the cfe-commits mailing list