I'm providing a bar constructor that takes a foo, and ints can be implicitly converted to foo as shown by the line preceding it. So, what is going wrong?
Chained-conversion is not allowed in C++, which means the (chained) conversion cannot occur:
int -> foo -> bar //not allowed (chained conversion)
even though the followings are given:
int -> foo //given
foo -> bar //given
So if you want int -> bar
to work, then add another constructor taking int
to class bar
.