
On Sat, Mar 22, 2008 at 09:58:08AM -0000, John Maddock wrote:
Actually I'm pretty annoyed that these warnings are generated by the compiler at all: as far as I can see they can never represent a true programming error - though I stand to be corrected on that one!
The warnings are raised when a class or structure does *not* have an explicit copy-constructor or assignment operator declared, *and* one could not be generated automatically by the compiler. However, the warnings are issued even though neither the copy-constructor nor the assignment operator are ever used - if they were used then you would get a compiler error.
One possible fix is to declare but not define a private copy constructor and assignment operator (rather like boost::noncopyable), but given that those definitions are never used, this is just syntactic sugar to shut the compiler up. BTW if I remember correctly you get the same warnings if you declare a class that inherits from noncopyable which rather destroys the whole point of that one :-(
Tellingly, as far as I know VC++ is the only compiler to issue this warning.
How about writing a bug report for the compiler? Jens