summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5d62ace9070..b44d977b6a4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3240,8 +3240,6 @@ void Sema::CheckFunctionDeclaration(FunctionDecl *NewFD,
Diag(NewFD->getLocation(), diag::err_destructor_name);
return NewFD->setInvalidDecl();
}
-
- CheckDestructor(Destructor);
}
Record->setUserDeclaredDestructor(true);
@@ -3265,6 +3263,12 @@ void Sema::CheckFunctionDeclaration(FunctionDecl *NewFD,
AddOverriddenMethods(Method->getParent(), Method);
}
+ // Additional checks for the destructor; make sure we do this after we
+ // figure out whether the destructor is virtual.
+ if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(NewFD))
+ if (!Destructor->getParent()->isDependentType())
+ CheckDestructor(Destructor);
+
// Extra checking for C++ overloaded operators (C++ [over.oper]).
if (NewFD->isOverloadedOperator() &&
CheckOverloadedOperatorDeclaration(NewFD))
OpenPOWER on IntegriCloud