Don't look for a destructor in a dependent type. Fixes PR7198.

llvm-svn: 104445
This commit is contained in:
Douglas Gregor 2010-05-22 17:12:29 +00:00
parent 0c6f539564
commit 024d80e571
2 changed files with 17 additions and 1 deletions

View File

@ -4795,7 +4795,7 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD,
void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) { void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Record->getDecl()); CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Record->getDecl());
if (!ClassDecl->isInvalidDecl() && !VD->isInvalidDecl() && if (!ClassDecl->isInvalidDecl() && !VD->isInvalidDecl() &&
!ClassDecl->hasTrivialDestructor()) { !ClassDecl->hasTrivialDestructor() && !ClassDecl->isDependentContext()) {
CXXDestructorDecl *Destructor = ClassDecl->getDestructor(Context); CXXDestructorDecl *Destructor = ClassDecl->getDestructor(Context);
MarkDeclarationReferenced(VD->getLocation(), Destructor); MarkDeclarationReferenced(VD->getLocation(), Destructor);
CheckDestructorAccess(VD->getLocation(), Destructor, CheckDestructorAccess(VD->getLocation(), Destructor,

View File

@ -24,3 +24,19 @@ namespace PR6045 {
(void)(k % member); (void)(k % member);
} }
} }
namespace PR7198 {
struct A
{
~A() { }
};
template<typename T>
struct B {
struct C : A {};
void f()
{
C c = C();
}
};
}