diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-02 20:59:25 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-02 20:59:25 +0000 |
| commit | 6f1e2c6d19a7f1e7d2e169f6a850a04e7e58687d (patch) | |
| tree | e383e153d0f8ed6c4b2eec7698dc4998c63327ff /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 74ae3f5a4569a94beeef1a86a01868346d2f58aa (diff) | |
| download | bcm5719-llvm-6f1e2c6d19a7f1e7d2e169f6a850a04e7e58687d.tar.gz bcm5719-llvm-6f1e2c6d19a7f1e7d2e169f6a850a04e7e58687d.zip | |
Finish PR10217: Ensure we say that a special member was implicitly, not
explicitly, deleted in all relevant cases, and explain why.
llvm-svn: 153894
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 856f921a784..216663607ca 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4636,6 +4636,13 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, return true; } + // For an anonymous struct or union, the copy and assignment special members + // will never be used, so skip the check. For an anonymous union declared at + // namespace scope, the constructor and destructor are used. + if (CSM != CXXDefaultConstructor && CSM != CXXDestructor && + RD->isAnonymousStructOrUnion()) + return false; + // C++11 [class.copy]p7, p18: // If the class definition declares a move constructor or move assignment // operator, an implicitly declared copy constructor or copy assignment @@ -4667,6 +4674,9 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, } } + // Do access control from the special member function + ContextRAII MethodContext(*this, MD); + // C++11 [class.dtor]p5: // -- for a virtual destructor, lookup of the non-array deallocation function // results in an ambiguity or in a function that is deleted or inaccessible @@ -4682,16 +4692,6 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, } } - // For an anonymous struct or union, the copy and assignment special members - // will never be used, so skip the check. For an anonymous union declared at - // namespace scope, the constructor and destructor are used. - if (CSM != CXXDefaultConstructor && CSM != CXXDestructor && - RD->isAnonymousStructOrUnion()) - return false; - - // Do access control from the special member function - ContextRAII MethodContext(*this, MD); - SpecialMemberDeletionInfo SMI(*this, MD, CSM, Diagnose); for (CXXRecordDecl::base_class_iterator BI = RD->bases_begin(), |

