Bug 375537 - clazy-rule-of-two-soft false positive if class has move assignment operator
Summary: clazy-rule-of-two-soft false positive if class has move assignment operator
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-25 11:03 UTC by Daniel Pfeifer
Modified: 2017-01-28 18:44 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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