mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Merge pull request #1381 from dave-bartolomeo/dave/CopyCtor
C++: Make `constructor-used-as-copy-constructor` warning/low
This commit is contained in:
@@ -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& 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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user