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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to