[clazy] [Bug 430672] New: Level 2 lint copyable-polymorphic is a false positive for pure virtual classes
bugzilla_noreply at kde.org
bugzilla_noreply at kde.org
Mon Dec 21 17:36:24 GMT 2020
https://bugs.kde.org/show_bug.cgi?id=430672
Bug ID: 430672
Summary: Level 2 lint copyable-polymorphic is a false positive
for pure virtual classes
Product: clazy
Version: unspecified
Platform: unspecified
OS: Microsoft Windows
Status: REPORTED
Severity: minor
Priority: NOR
Component: general
Assignee: unassigned-bugs at kde.org
Reporter: bepzi at bepzi.com
CC: smartins at kde.org
Target Milestone: ---
SUMMARY
The lint for classes that are both copyable and polymorphic triggers for pure
virtual classes, which can't be constructed or copied at all.
The implementation checks if 1) it's polymorphic and 2) if there's a callable
copy constructor or copy-assign constructor:
https://github.com/KDE/clazy/blob/4a4742c750a563180cbf65c2438540cc7e700f7a/src/checks/level2/copyable-polymorphic.cpp#L56-L63
But pure virtual classes can have "callable" (as determined by this code) copy
constructors despite not actually being copyable or even constructable.
STEPS TO REPRODUCE
1. Create a class with a pure virtual method and a not-deleted copy or
copy-assign constructor.
2. Run clazy with the level 2 lint 'copyable-polymorphic' enabled.
3. Observe that clazy flags the pure virtual class for being a copyable
polymorphic.
OBSERVED RESULT
Pure virtual classes are flagged as needing their copy and copy-assign
constructors deleted.
EXPECTED RESULT
The lint should not trigger, because pure virtual classes cannot be constructed
or copied and are not vulnerable to vtable slicing.
SOFTWARE/OS VERSIONS
Windows: 10.0.19042 Build 19042
Qt Version: 5.12.9
Qt Creator: 4.14.0 (Dec 17 2020)
Clazy: (`clazy-standalone.exe --version` only reports that it's based on LLVM
version 11.0.0)
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Unassigned-bugs
mailing list