[PATCH] D11517: [Sema] Add a note to point to the inaccessible destructor.
Richard Smith
richard at metafoo.co.uk
Sun Jul 26 14:01:50 PDT 2015
rsmith added inline comments.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:5575-5581
@@ +5574,9 @@
+ // Explain the reasons of inaccessibility.
+ if (Field) {
+ if (CXXRecordDecl *C = Field->getType()->getAsCXXRecordDecl()) {
+ CXXDestructorDecl *D = S.LookupDestructor(C);
+ if (D && !D->isImplicit())
+ S.Diag(D->getLocStart(), diag::note_destructor_here);
+ }
+ }
+ }
----------------
This doesn't seem right: you're producing a note for a destructor no matter which special member function was found to be inaccessible. The best thing to do would be to ask the SemaAccess code to produce the relevant note (see DiagnoseAccessPath); that way you can produce a note that says "declared private here" or whatever else is relevant (which can sometimes be that a virtual base destructor is inaccessible due to a private access path, for instance).
Repository:
rL LLVM
http://reviews.llvm.org/D11517
More information about the cfe-commits
mailing list