Issue 151005
Summary clang-tidy cppcoreguidelines-special-member-functions should encourage rule of zero
Labels clang-tidy
Assignees
Reporter peakschris
    The current wording in cppcoreguidelines-special-member-functions description and documentation encourages classes with a default or no-op destructor to be converted into rule of five classes.

Take:

*myclass.hxx*
```
class myclass
{
    myclass();
 ~myclass();
}
```

*myclass.cxx*
```
myclass::~myclass()
{
}
```

clang-tidy on cxx yields:
`Use '= default' to define a trivial destructor (fix available)`

clang-tidy on hxx yields:
`Class 'myclass' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator`

Neither message encourages the developer to remove the destructor hence creating a rule-of-zero class as per: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-zero

Both messages encourage a new developer to add special functions instead.

Perhaps this requires a custom rule-of-zero check
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to