Extra Clang Tools 3.8 documentation

clang-tidy - modernize-use-default

«  modernize-use-auto   ::   Contents   ::   modernize-use-nullptr  »

modernize-use-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

Copy-constructor, copy-assignment operator, move-constructor and move-assignment operator are not supported yet.

«  modernize-use-auto   ::   Contents   ::   modernize-use-nullptr  »