> > I would have expected a compile error, since the declaration > > "Foo bar = foo;" tries to use the non-existant default constructor for > > class Foo. > > No, it doesn't. This is not a initialization followed by an assignment > operator; there is no assignment operator at all in this statement. > Instead, it is a copy-initialization, which invokes the copy > constructor.
But then shouldn't it be the case that there is no automatic copy constructor, since I've defined my own constructor? i.e., again there should be a compile error? > The difference between initialization and assignment should be > explained in every C++ text book. So shoot me. Ben.