Summary: | Level 2 lint copyable-polymorphic is a false positive for pure virtual classes | ||
---|---|---|---|
Product: | [Developer tools] clazy | Reporter: | bepzi |
Component: | general | Assignee: | Unassigned bugs mailing-list <unassigned-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | faure, smartins |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Microsoft Windows | ||
Latest Commit: | https://invent.kde.org/sdk/clazy/commit/9ec85f78a18c031e49cdc62517175bfee7ee92ea | Version Fixed In: | |
Sentry Crash Report: |
Description
bepzi
2020-12-21 17:36:24 UTC
If they can't be copied why do they have a copy-ctor in the first place ? So that subclasses can be copied. Of course the right way to do this then is to make the copy constructor protected (rather than defaulting to public) in the base class. See https://bugs.kde.org/show_bug.cgi?id=438027, which I now believe is the same bug, sorry about that. Git commit 9ec85f78a18c031e49cdc62517175bfee7ee92ea by Sergio Martins. Committed on 03/06/2021 at 21:45. Pushed by smartins into branch 'master'. copyable-polymorphic: Don't warn for some final classes If the class is final and its base classes don't have public copy-ctor/assign then it's ok Related: bug 438027 M +28 -4 src/checks/level2/copyable-polymorphic.cpp M +23 -0 tests/copyable-polymorphic/main.cpp M +1 -0 tests/copyable-polymorphic/main.cpp.expected https://invent.kde.org/sdk/clazy/commit/9ec85f78a18c031e49cdc62517175bfee7ee92ea |