Bug 377858

Summary: False warnings about missing explicit with move constructors
Product: [Developer tools] krazy Reporter: Friedrich W. H. Kossebau <kossebau>
Component: generalAssignee: Allen Winter <winter>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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.