File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -9763,15 +9763,22 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD,
9763
9763
CXXSpecialMemberKind CSM,
9764
9764
InheritedConstructorInfo *ICI,
9765
9765
bool Diagnose) {
9766
+ assert(LangOpts.CPlusPlus &&
9767
+ "Special member function = default outside of C++?");
9766
9768
if (MD->isInvalidDecl())
9767
9769
return false;
9768
9770
CXXRecordDecl *RD = MD->getParent();
9769
9771
assert(!RD->isDependentType() && "do deletion after instantiation");
9770
- if (!LangOpts.CPlusPlus ||
9771
- (!LangOpts.CPlusPlus11 && !RD->isLambda() &&
9772
- !MD->isExplicitlyDefaulted()) ||
9773
- RD->isInvalidDecl())
9772
+ if (RD->isInvalidDecl())
9774
9773
return false;
9774
+ if (!LangOpts.CPlusPlus11) {
9775
+ // Before C++11, implicitly-declared (defaulted) special member functions
9776
+ // weren't defined as deleted.
9777
+ // Allow lambda members and explicitly defaulted members to be defined
9778
+ // as deleted before C++11 as an extension
9779
+ if (!(RD->isLambda() || MD->isExplicitlyDefaulted()))
9780
+ return false;
9781
+ }
9775
9782
9776
9783
// C++11 [expr.lambda.prim]p19:
9777
9784
// The closure type associated with a lambda-expression has a
You can’t perform that action at this time.
0 commit comments