[PATCH] D53860: [SemaCXX] Don't check base's dtor is accessible

Taewook Oh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 30 12:57:33 PDT 2018


twoh added a comment.

I think the context is Derived here. My understanding of http://wg21.link/p0968r0#2227 (in this patch's context) is that when Derived is aggregate initialized, the destructor for each element of Base is potentially invoked as well.

For me it seems that the bug is checking destructor accessibility of Base itself, not fields of Base. I think the right fix for 1956-1960 is

  if (!VerifyOnly) {
    auto *BaseRD = Base.getType()->getAs<RecordType>()->getDecl();
    for (FieldDecl *FD : BaseRD->fields()) {
      QualType ET = SemaRef.Context.getBaseElementType(FD->getType());
      if (hasAccessibleDestructor(ET, InitLoc, SemaRef)) {
        hadError = true;
        return;
      }
    }
  }


Repository:
  rC Clang

https://reviews.llvm.org/D53860





More information about the cfe-commits mailing list