diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6eb8955dbca..7d9c25ed2dd 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6332,7 +6332,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // any translation unit may need to emit a deleting destructor. if (SemaRef.Context.getTargetInfo().getCXXABI().isMicrosoft() && !Record->isDependentType() && Record->getDefinition() && - !Record->isBeingDefined()) { + !Record->isBeingDefined() && !NewDD->isDeleted()) { SemaRef.CheckDestructor(NewDD); } @@ -12082,12 +12082,6 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl, if (getLangOpts().CPlusPlus11) AdjustDestructorExceptionSpec(CXXRecord, CXXRecord->getDestructor()); - - // The Microsoft ABI requires that we perform the destructor body - // checks (i.e. operator delete() lookup) at every declaration, as - // any translation unit may need to emit a deleting destructor. - if (Context.getTargetInfo().getCXXABI().isMicrosoft()) - CheckDestructor(CXXRecord->getDestructor()); } // Add any implicitly-declared members to this class. diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 76623a90d56..117c37b636e 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4469,6 +4469,15 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) { } } } + + if (Record->hasUserDeclaredDestructor()) { + // The Microsoft ABI requires that we perform the destructor body + // checks (i.e. operator delete() lookup) in any translataion unit, as + // any translation unit may need to emit a deleting destructor. + if (Context.getTargetInfo().getCXXABI().isMicrosoft() && + !Record->getDestructor()->isDeleted()) + CheckDestructor(Record->getDestructor()); + } } // C++11 [dcl.constexpr]p8: A constexpr specifier for a non-static member |

