Bug 354977

Summary: false positives in rule-of-two-soft
Product: [Developer tools] clazy Reporter: Nyall Dawson <nyall.dawson>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: eric.lemanissier, smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nyall Dawson 2015-11-07 07:10:31 UTC
I'm seeing some false positives in the rule-of-two-soft check:

- Using assign operator but class QModelIndex has copy-ctor but no assign operator 
-Using copy-ctor but class QPair has a trivial copy-ctor but non trivial assign operator 

These two classes could probably be ignored safely in the check
Comment 1 Sergio Martins 2015-11-12 12:13:55 UTC
these warnings are not false-positives, but will blacklist those classes since it can't be fixed in Qt 4, thanks
Comment 2 Sergio Martins 2015-11-12 12:44:47 UTC
Git commit 40710f301343dcf78efc78aa3c6c13b775a7b86c by Sergio Martins.
Committed on 12/11/2015 at 12:42.
Pushed by smartins into branch 'master'.

rule-of-two-soft: Blacklist some cases that are safe

We can't fix QModelIndex and QPair in Qt4, so don't warn.
In Qt5 they are fixed already.

M  +5    -1    checks/ruleofbase.cpp
M  +2    -2    tests/rule-of-two-soft/main.cpp

http://commits.kde.org/clazy/40710f301343dcf78efc78aa3c6c13b775a7b86c
Comment 3 eric.lemanissier 2015-11-12 14:31:30 UTC
I detected the following warnings for rule of three:
QTypedArrayData::iterator
QTypedArrayData::const_iterator
QStringBuilder
QVariant::Private
QSet
QSet::iterator
QSet::const_iterator

and for rule of two:
QByteRef 
QCharRef 
QVariant::Private

but i'm not sure if these should be fixed in Qt, or if they are false positives