So, I have the following code that cannot be compiled on gcc 4.2.1 on OSX. The error I am getting is:
testref.cpp: In function 'int main()': testref.cpp:10: error: 'A::A(const A&)' is private testref.cpp:20: error: within this context
And here is the code
This copy constructor is not needed in this case, since f gets the link (I made it public to find out if it was called, and it was not specified). In addition, I made f the value of the object by value, and so far no copy constructor or operator = has been called. I suspect this may be due to optimization. Any suggestions? Thanks.
source share