Merge pull request #1381 from dave-bartolomeo/dave/CopyCtor

C++: Make `constructor-used-as-copy-constructor` warning/low
This commit is contained in:
Jonas Jensen
2019-05-31 09:15:37 +02:00
committed by GitHub
3 changed files with 4 additions and 4 deletions

View File

@@ -11,8 +11,7 @@ when their default arguments are taken into account. An example would be a const
of the form <code>X(const X&amp; rhs, int i = 0)</code>. A compiler will use such a constructor as a copy
constructor in preference to the default member-wise copy constructor that it would otherwise generate.
Since this is usually not what was intended, constructors of the form often do not provide the right
semantics for copying objects of the class, making them potentially dangerous. Even when this sort of
thing has been done intentionally, it is confusing and in bad taste, and should be avoided.
semantics for copying objects of the class, making them potentially dangerous.
</p>
</overview>

View File

@@ -2,8 +2,8 @@
* @name Constructor with default arguments will be used as a copy constructor
* @description Constructors with default arguments should not be signature-compatible with a copy constructor when their default arguments are taken into account.
* @kind problem
* @problem.severity error
* @precision high
* @problem.severity warning
* @precision low
* @id cpp/constructor-used-as-copy-constructor
* @tags reliability
* readability