Bug 377858 - False warnings about missing explicit with move constructors
Summary: False warnings about missing explicit with move constructors
Status: RESOLVED FIXED
Alias: None
Product: krazy
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Allen Winter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-20 22:29 UTC by Friedrich W. H. Kossebau
Modified: 2017-03-24 22:54 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2017-03-20 22:29:22 UTC
The [explicit] check currently wants move constructors to be declared "explicit". Which might run against recommended practices?

I am only still learning since recently about move constructors, but if I understood correctly move constructors should have the same handling as the copy constructors they overload with together, as some template algorithms expect this now and then, so the only decision is by lvalue vs. rvalue and not due to different explicit declarations.

Example for false negative on move constructor:

Krazy result listed at
http://ebn.kde.org/krazy/reports/extragear/kdevelop/kdevplatform/
has for item "10. Check for C++ ctors that should be declared 'explicit' [explicit]...OOPS! 14 issues found!"
as first hit
    plugins/outlineview/outlinenode.h: line# 43 (1) 
which is
    OutlineNode(OutlineNode&& other) Q_DECL_NOEXCEPT;
https://lxr.kde.org/source/extragear/kdevelop/kdevplatform/plugins/outlineview/outlinenode.h#0043
Comment 1 Allen Winter 2017-03-24 22:17:49 UTC
indeed.
Comment 2 Allen Winter 2017-03-24 22:54:43 UTC
fixed.
should take a day or 2 to show up on the EBN.