erichkeane added a comment.

In D125402#3553802 <https://reviews.llvm.org/D125402#3553802>, @aaron.ballman 
wrote:

> In D125402#3517865 <https://reviews.llvm.org/D125402#3517865>, @nlee wrote:
>
>> How about adding CXXRecordDecl::hasMoveConstructor() to ensure the type is 
>> movable? I ran a test with OpenCV(c++11), and it returned some useful 
>> warnings:
>
> I don't think that will be quite correct -- IIRC, that would still return 
> true if the move constructor was deleted. `hasSimpleMoveConstructor()` and 
> `hasSimpleMoveAssignment()` might be a better approach.

The 'Simple' version might not be quite right... That is implemented as:

  bool hasSimpleMoveConstructor() const {
     return !hasUserDeclaredMoveConstructor() && hasMoveConstructor() &&
            !data().DefaultedMoveConstructorIsDeleted;
   }


So this would still warn about user-defined move constructors.

HOWEVER, I might suggest `hasMoveConstructor() && 
!defaultedMoveConstructorIsDeleted()` for the ctor test.  There is similar 
storage for the 'DefaultedMoveAssignmentIsDeleted`, but it isn't exposed, so 
you might need to add a function to expose it in DeclCXX.h.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125402/new/

https://reviews.llvm.org/D125402

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

Reply via email to