[PATCH] D68185: [Diagnostics] Warn when class implements a copy constructor/copy assignment operator, but missing the copy assignment operator/copy constructor
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 28 13:37:19 PDT 2019
Quuxplusone added a comment.
Please add test cases showing the intended behavior for
- when the copy constructor is explicitly defaulted but the copy assignment operator is {implicitly defaulted, implicitly deleted, user-provided}
- when the copy assignment operator is explicitly defaulted but the copy constructor is {implicitly defaulted, implicitly deleted, user-provided}
- when the {copy constructor, copy assignment operator} is user-provided but the other is implicitly deleted
An example of an implicitly deleted copy assignment operator would be
struct A {
int& x;
A(const A& rhs) : x(rhs.x) {}
};
Also, how does the presence of a user-provided destructor interact with this diagnostic? If I provide a destructor but implicitly default my copy operations, isn't that just as bad, Rule-of-Three-wise?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68185/new/
https://reviews.llvm.org/D68185
More information about the cfe-commits
mailing list