Prior to 3.4, a private copy constructor works just fine. In 3.4.1, it seems that a simple example as below will fail with a message: gccbug.cxx: In function `int main()': gccbug.cxx:17: error: `Simple::Simple(const Simple&)' is private gccbug.cxx:32: error: within this context class Simple { public: Simple (int i) : m_i (i) {} int m_i; private: Simple (const Simple&); // hide this }; std::ostream & operator<< (std::ostream & f, const Simple & s) { f << s.m_i; return f; } I have a variation on this test that has a public copy constructor that asserts if it's called. The test program never calls the copy constructor. Is this a change in the language or a bug?
Created attachment 6607 [details] Simple test of private copy constructor compile with -DTESTER to demonstrate that copy constructor is never called compile without any flags to see private copy constructor warning message.
That's what the language requires. See the release notes of gcc 3.4.0. W.
Reopening to mark as a dup of ...
bug 12226. *** This bug has been marked as a duplicate of 12226 ***