C and C++


LANG.TYPE.UIGO : Unneeded Implicitly Generated Operations

要旨

A class has one or more implicitly generated operations that are never used.

The operations that may be implicitly generated are:

A warning of this class may indicate that code that is intended to use an implicitly generated operation is not behaving as expected.
You can prevent implicit generation for a specific operation by declaring the function private and leaving it undefined, or by explicitly deleting it with =delete.

プロパティ

クラス名 Unneeded Implicitly Generated Operations
日本語クラス名 Unneeded Implicitly Generated Operations
クラス分類 スタイル (style)
ニーモニック LANG.TYPE.UIGO
カテゴリー
CWE CWE:1076 Insufficient Adherence to Expected Conventions
JSF++ JSF++:68 Unneeded implicitly generated member functions shall be explicitly disallowed.
対応言語 C++ のみ利用可能です。 C は利用できません。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Unneeded Implicitly Generated Operations"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

class A { // 'Unneeded Implicitly Defined Operation' warning issued here.
          // The warning will list the following, which are implicitly defined but never used.
          // - copy assignment operator
          // - move constructor
          // - move assignment operator
          //
          // There is no implicitly defined default constructor, because it's explicitly defined.
          // The implicitly defined copy constructor is used in do_A().

  public:
    A() {};                         // Default constructor explicitly defined.
                                    // Copy constructor NOT explicitly defined.
};

void do_A(A one) {
    A two(one);                     // Implicitly defined copy constructor used here.
}

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。