hicpp-undelegated-constructor¶
此检查是 bugprone-undelegated-constructor 的别名。部分实现了 规则 12.4.5 以查找构造函数内部的错误放置的构造函数调用。
struct Ctor {
Ctor();
Ctor(int);
Ctor(int, int);
Ctor(Ctor *i) {
// All Ctor() calls result in a temporary object
Ctor(); // did you intend to call a delegated constructor?
Ctor(0); // did you intend to call a delegated constructor?
Ctor(1, 2); // did you intend to call a delegated constructor?
foo();
}
};