aaron.ballman added inline comments.
================ Comment at: clang/lib/AST/ASTContext.cpp:2817 + // unique representation. + if (Field->isUnnamedBitfield() && BitfieldSize > 0) + return std::nullopt; ---------------- I think the check for a non-zero bit-field width might not be completely correct in cases where it's used to split an allocation unit. I suggested a test case below. ================ Comment at: clang/test/SemaCXX/type-traits.cpp:2886-2889 +struct UnnamedEmptyBitfield { + int named; + int : 0; +}; ---------------- I think there's one more test to add: ``` struct UnnamedEmptyBitfieldSplit { short named; int : 0; short also_named; }; static_assert(sizeof(UnnamedEmptyBitfieldSplit) != (sizeof(short) * 2)); static_assert(!has_unique_object_representations<UnnamedEmptyBitfieldSplit>::value, "Bitfield padding"); ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145852/new/ https://reviews.llvm.org/D145852 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits