class C {
public:
C() { }
};
class B {
public:
B(C c) { }
B() { }
};
class A {
public:
A(bool b) { }
A(B b) { }
};
int main() {
A a1 = true; // bool -> A is allowed
A a2 = B(); // B -> A is allowed
A a3 = 7; // int -> bool -> A is allowed
A a4 = C(); // C -> B -> A isn't allowed
}
Why I can use two-step implicit conversion with bool but can’t use it with C?
What is the general rule describing multistep implicit conversion?
There is no multi-step user-defined implicit conversion.
is allowed because the
int->boolconversion isn’t user-defined.12.3 Conversions [class.conv]