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; +} +}
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; +} +}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits