Check the access of operator delete from the destructor context
Previously we would do the access check from the context of
MarkVTableUsed.
Also update this test to C++11, since that is typically used with the MS
C++ ABI.
Fixes PR20005.
llvm-svn: 210850
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index d9d4097..57e6550 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -12462,7 +12462,9 @@
Class->hasUserDeclaredDestructor() &&
!Class->getDestructor()->isDefined() &&
!Class->getDestructor()->isDeleted()) {
- CheckDestructor(Class->getDestructor());
+ CXXDestructorDecl *DD = Class->getDestructor();
+ ContextRAII SavedContext(*this, DD);
+ CheckDestructor(DD);
}
}