malcolm.parsons added inline comments.

================
Comment at: clang-tidy/modernize/UseEqualsDefaultCheck.cpp:117
+                                             const CXXMethodDecl *Operator) {
+  const auto *Record = Operator->getParent();
+
----------------
aaron.ballman wrote:
> Please don't use `auto` here or elsewhere if the type is not explicitly 
> spelled out.
This was copied from `isCopyAssignmentAndCanBeDefaulted()`.


================
Comment at: clang-tidy/modernize/UseEqualsDefaultCheck.cpp:119-120
+
+  // A defaulted default constructor of a union with a field with a non trivial
+  // default constructor would be deleted.
+  if (Record->isUnion()) {
----------------
aaron.ballman wrote:
> This does not match what's in [class.ctor]p5.
> 
> "X is a union that has a variant member with a non-trivial default 
> constructor and no variant member of X has a default member initializer" -- 
> you aren't checking for the default member initializer.
> 
> also missing for unions: "X is a union and all of its variant members are of 
> const-qualified type (or array thereof)"
> 
> (You should add test cases for these.)
> 
> It might make more sense to implement this as 
> `CXXRecordDecl::defaultedDestructorIsDeleted()`?
Is there any way to call `Sema::ShouldDeleteSpecialMember()` from a clang-tidy 
check?


================
Comment at: clang-tidy/modernize/UseEqualsDefaultCheck.cpp:127
+
+      if (const RecordType *RecordTy = T->getAs<RecordType>()) {
+        CXXRecordDecl *FieldRec = cast<CXXRecordDecl>(RecordTy->getDecl());
----------------
aaron.ballman wrote:
> You can use `auto` here and below.
This was copied from `CXXRecordDecl::addedMember()`.


https://reviews.llvm.org/D38179



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to