[PATCH] D20923: [Sema] Fix a crash on invalid where invalid defaulted function is called
Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 20 13:11:16 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273193: [Sema] Only define function as move assignment when needed (authored by epilk).
Changed prior to commit:
http://reviews.llvm.org/D20923?vs=59409&id=61296#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20923
Files:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
Index: cfe/trunk/lib/Sema/SemaExpr.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp
+++ cfe/trunk/lib/Sema/SemaExpr.cpp
@@ -13012,7 +13012,7 @@
if (MethodDecl->isDefaulted() && !MethodDecl->isDeleted()) {
if (MethodDecl->isCopyAssignmentOperator())
DefineImplicitCopyAssignment(Loc, MethodDecl);
- else
+ else if (MethodDecl->isMoveAssignmentOperator())
DefineImplicitMoveAssignment(Loc, MethodDecl);
}
} else if (isa<CXXConversionDecl>(MethodDecl) &&
Index: cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
+++ cfe/trunk/test/SemaCXX/cxx0x-defaulted-functions.cpp
@@ -196,3 +196,15 @@
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;
+}
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20923.61296.patch
Type: text/x-patch
Size: 1122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160620/1ce3b455/attachment.bin>
More information about the cfe-commits
mailing list