clang-tidy - modernize-use-equals-default — Extra Clang Tools 20.1.8 documentation

# Extra Clang Tools 20.1.8 documentation

## clang-tidy - modernize-use-equals-default

# modernize-use-equals-default

This check replaces default bodies of special member functions with `= default;`. The explicitly defaulted function declarations enable more opportunities in optimization, because the compiler might treat explicitly defaulted functions as trivial.

    struct A {
      A() {}
      ~A();
    };
    A::~A() {}

    // becomes

    struct A {
      A() = default;
      ~A();
    };
    A::~A() = default;

Note

Move-constructor and move-assignment operator are not supported yet.

## Options

IgnoreMacros

  If set to true, the check will not give warnings inside macros and will ignore special members with bodies contain macros or preprocessor directives. Default is true.