Bug 388677 - rule-of-three warning in class that is not copyable
Summary: rule-of-three warning in class that is not copyable
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: 2018-01-08 13:10 UTC by Albert Astals Cid
Modified: 2018-01-08 18:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
main.cpp (370 bytes, text/x-c++src)
2018-01-08 13:10 UTC, Albert Astals Cid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2018-01-08 13:10:54 UTC
Created attachment 109734 [details]
main.cpp

Clazy says

main.cpp:19:1: warning: B has dtor but not copy-ctor, copy-assignment [-Wclazy-rule-of-three]
class B : public A
^
1 warning generated.

on the attached code.

I think the warning doesn't make sense since B is not copyable (as demonstrated if you uncomment the commented code in main)
Comment 1 Sergio Martins 2018-01-08 18:32:04 UTC
commit 0e86a561361f1cafc2680d3966cd126c5cd9034e (HEAD -> 1.3, origin/1.3)
Author: Sergio Martins <smartins@kde.org>
Date:   Mon Jan 8 18:21:59 2018 +0000

    rule-of-three: Don't warn if either copy-assign or copy-ctor is deleted
    
    It's safe, as it won't happen that one of the user-methods will do
    something different from the compiler-generated-method, as one of
    them can't be called.
    
    BUG: 388677