I've seen the following type mistake a couple of times while working with C++ code:
QString str = str.toUpper();
This can be a fairly easy mistake to make and yet it compiles and executes (sometimes with crashes, sometimes without). I can't see any circumstances under which it would be something that you'd actually want to do.
Some testing has revealed that the copy constructor is invoked, not the default one, and that the object is being given itself from within the copy constructor.
Can anyone explain why this isn't a compiler error, or even a warning?