I am passing an unnamed temporary object to a function defined with const ref parameter. The copy ctor of the class is private, and I get a compilation error. I don\'t under
Because a(1) calls the constructor A(int i) and then A(const A&) is called in the call to void f(const A&).
Make the A(int i) constructor explicit and you should not face this error.
Edit: I think i misunderstood the question. I might delete this.