Bug 375537

Summary: clazy-rule-of-two-soft false positive if class has move assignment operator
Product: [Developer tools] clazy Reporter: Daniel Pfeifer <daniel>
Component: generalAssignee: Sergio Martins <smartins>
Status: RESOLVED FIXED    
Severity: normal CC: daniel, smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Daniel Pfeifer 2017-01-25 11:03:18 UTC
std::thread t;
t = std::thread(...);

Clazy reports: Using assign operator but class std::thread has copy-ctor but no assign operator.

This is not accurate.  Class std::thread does have an assignment operator!  It has a move assignment operator but no copy assignment operator.  In the above code, the assignment operator is passed a prvalue.  This executes the move assignment operator, not a copy-ctor.
Comment 1 Sergio Martins 2017-01-25 11:29:29 UTC
thanks, will have a look
Comment 2 Sergio Martins 2017-01-25 11:44:25 UTC
Git commit 6358b56182a85d962175686db87dd7cb3f40ffe9 by Sergio Martins.
Committed on 25/01/2017 at 11:43.
Pushed by smartins into branch 'master'.

rule-of-two-soft: Add unit-test for a bug

A  +7    -0    tests/rule-of-two-soft/bug375537.cpp     [License: UNKNOWN]  *
M  +4    -0    tests/rule-of-two-soft/config.json

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/clazy/6358b56182a85d962175686db87dd7cb3f40ffe9
Comment 3 Sergio Martins 2017-01-25 22:04:38 UTC
Forgot to use BUG in the commit message.

But this is fixed now

commit 6fb181bccceaf7dec6bb1d57c849f5156dd54dc3
Author: Sergio Martins <smartins@kde.org>
Date:   Wed Jan 25 22:01:53 2017 +0000

    rule-of-two-soft: Don't warn when using move assign operator
    
    Comparing by opertator name wasn't a good idea, also not very clean,
    so use the proper way too