[PATCH] D45174: non-zero-length bit-fields should make a class non-empty

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 17:50:19 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D45174#1055048, @rsmith wrote:

> I wonder if we can delete the `getNonVirtualSize()` check now -- I don't see any way that an empty class can have a nonzero nvsize except by this nonempty anonymous bit-fields situation.


Yup, looks like:

     if (!FoundBase) {
  -    if (MDCUsesEBO && BaseDecl->isEmpty() &&
  -        BaseLayout.getNonVirtualSize() == CharUnits::Zero()) {
  +    if (MDCUsesEBO && BaseDecl->isEmpty()) {
  +      assert(BaseLayout.getNonVirtualSize() == CharUnits::Zero());
         BaseOffset = CharUnits::Zero();
       } else {

Zero test failures.


Repository:
  rC Clang

https://reviews.llvm.org/D45174





More information about the cfe-commits mailing list