Temporarily revert r183462: "Implement DR7"

This fixes PR16370, I'll add the test case in a follow-up commit.

llvm-svn: 184401
This commit is contained in:
Chandler Carruth 2013-06-20 07:06:34 +00:00
parent 38c7bc1748
commit 8a76fcf61f
3 changed files with 10 additions and 20 deletions

View File

@ -1023,8 +1023,8 @@ def err_access_dtor_base :
Error<"base class %0 has %select{private|protected}1 destructor">,
AccessControl;
def err_access_dtor_vbase :
Error<"inherited virtual base class %1 has "
"%select{private|protected}2 destructor">,
Error<"inherited virtual base class %0 has "
"%select{private|protected}1 destructor">,
AccessControl;
def err_access_dtor_temp :
Error<"temporary of type %0 has %select{private|protected}1 destructor">,

View File

@ -1311,7 +1311,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
assert(BaseDecl && "Record type has no declaration");
BaseDecl = BaseDecl->getDefinition();
assert(BaseDecl && "Base type is not incomplete, but has no definition");
CXXRecordDecl *CXXBaseDecl = cast<CXXRecordDecl>(BaseDecl);
CXXRecordDecl * CXXBaseDecl = cast<CXXRecordDecl>(BaseDecl);
assert(CXXBaseDecl && "Base type is not a C++ type");
// C++ [class]p3:
@ -3790,17 +3790,10 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
CXXDestructorDecl *Dtor = LookupDestructor(BaseClassDecl);
assert(Dtor && "No dtor found for BaseClassDecl!");
if (CheckDestructorAccess(
ClassDecl->getLocation(), Dtor,
PDiag(diag::err_access_dtor_vbase)
<< Context.getTypeDeclType(ClassDecl) << VBase->getType(),
Context.getTypeDeclType(ClassDecl)) ==
AR_accessible) {
CheckDerivedToBaseConversion(
Context.getTypeDeclType(ClassDecl), VBase->getType(),
diag::err_access_dtor_vbase, 0, ClassDecl->getLocation(),
SourceRange(), DeclarationName(), 0);
}
CheckDestructorAccess(ClassDecl->getLocation(), Dtor,
PDiag(diag::err_access_dtor_vbase)
<< VBase->getType(),
Context.getTypeDeclType(ClassDecl));
MarkFunctionReferenced(Location, const_cast<CXXDestructorDecl*>(Dtor));
DiagnoseUseOfDecl(Dtor, Location);

View File

@ -59,13 +59,10 @@ namespace dr5 { // dr5: yes
const C c = e;
}
namespace dr7 { // dr7: yes
namespace dr7 { // dr7: no
class A { public: ~A(); };
class B : virtual private A {}; // expected-note 2 {{declared private here}}
class C : public B {} c; // expected-error 2 {{inherited virtual base class 'dr7::A' has private destructor}} \
// expected-note {{implicit default constructor for 'dr7::C' first required here}} \
// expected-note {{implicit destructor for 'dr7::C' first required here}}
class VeryDerivedC : public B, virtual public A {} vdc;
class B : virtual private A {};
class C : public B {} c; // FIXME: should be rejected, ~A is inaccessible
class X { ~X(); }; // expected-note {{here}}
class Y : X { ~Y() {} }; // expected-error {{private destructor}}