Skip to content
Snippets Groups Projects
Commit 38538eaf authored by Erik Pilkington's avatar Erik Pilkington
Browse files

[Sema] Only define function as move assignment when needed

Fixes PR27941, a crash on invalid.

Differential revision: http://reviews.llvm.org/D20923

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273193 91177308-0d34-0410-b5e6-96231b3b80d8
parent 5a7e51b9
No related branches found
No related tags found
No related merge requests found
......@@ -13012,7 +13012,7 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
if (MethodDecl->isDefaulted() && !MethodDecl->isDeleted()) {
if (MethodDecl->isCopyAssignmentOperator())
DefineImplicitCopyAssignment(Loc, MethodDecl);
else
else if (MethodDecl->isMoveAssignmentOperator())
DefineImplicitMoveAssignment(Loc, MethodDecl);
}
} else if (isa<CXXConversionDecl>(MethodDecl) &&
......
......@@ -196,3 +196,15 @@ namespace PR15597 {
A<int> a;
B<int> b; // expected-note {{here}}
}
namespace PR27941 {
struct ExplicitBool {
ExplicitBool &operator=(bool) = default; // expected-error{{only special member functions may be defaulted}}
int member;
};
int fn() {
ExplicitBool t;
t = true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment