Bug 388682 - rule-of-three warning in class that has a deleted copy assignment operator
Summary: rule-of-three warning in class that has a deleted copy assignment operator
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-08 14:56 UTC by Albert Astals Cid
Modified: 2018-01-08 23:53 UTC (History)
1 user (show)

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


Attachments
main.cpp (208 bytes, text/x-c++src)
2018-01-08 14:56 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 14:56:02 UTC
Created attachment 109736 [details]
main.cpp

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

My understanding is that since we're delting the copy-assignment the code is "safe" and the warning should not trigger.
Comment 1 Sergio Martins 2018-01-08 23:53:28 UTC
Git commit 451664d8726b176e23f9bbef9d61d21073f0f198 by Sergio Martins.
Committed on 08/01/2018 at 23:51.
Pushed by smartins into branch '1.3'.

rule-of-three: Improve last commit

Now it also fixes the second bug
Our previous fix wasn't being run because it was in the if (numImplemeted == 1),
so failed for the case where we have a user-dtor, user-copy-ctor and deleted-copy-assign.

Moving the check out of the if fixes it.

M  +11   -6    src/checks/level2/ruleofthree.cpp
A  +16   -0    tests/rule-of-three/bug388682.cpp     [License: UNKNOWN]  *
A  +0    -0    tests/rule-of-three/bug388682.cpp.expected
M  +3    -0    tests/rule-of-three/config.json

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


https://commits.kde.org/clazy/451664d8726b176e23f9bbef9d61d21073f0f198