From 62341d3bde21c85405318950ed8d26b6b3e36544 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 20 Jun 2013 07:06:34 +0000 Subject: [PATCH] Temporarily revert r183462: "Implement DR7" This fixes PR16370, I'll add the test case in a follow-up commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184401 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticSemaKinds.td | 4 ++-- lib/Sema/SemaDeclCXX.cpp | 17 +++++------------ test/CXX/drs/dr0xx.cpp | 9 +++------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 323473fe74..1873ef02e9 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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">, diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index d09b0ee2a5..5a70d2a251 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -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(BaseDecl); + CXXRecordDecl * CXXBaseDecl = cast(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(Dtor)); DiagnoseUseOfDecl(Dtor, Location); diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp index 9af1656d43..967a2baaa3 100644 --- a/test/CXX/drs/dr0xx.cpp +++ b/test/CXX/drs/dr0xx.cpp @@ -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}} -- 2.40.0