Clang should have a warning when classes do not follow rule of three
| Bugzilla Link | 46385 |
| Version | trunk |
| OS | All |
| CC | @dwblaikie,@zmodem,@zygoloid |
Extended Description
Chrome folks suggest at here, https://bugs.chromium.org/p/chromium/issues/detail?id=979077.
It is good to have a warning that enforces the rule of three https://en.cppreference.com/w/cpp/language/rule_of_three. Whenever a class has only one or two of user-defined destructor, a user-defined copy constructor and a user-defined copy assignment operator, Clang warns at this class.
There already exists a clang-tidy check for this, https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-special-member-functions.html
You can get 2/3 of this with -Wdeprecated-copy-dtor (though it's on-use, rather than in the class itself). Beyond that I think it's more in the realm of clang-tidy than the clang compiler itself.