When I call this method and print the return value (I'm printing the char array actuallay, not the object itself), I receive complete garbage, which is carried out as a bunch of squares.
But when I return a temporary object return MyString(tmp), everything works fine. Initially i suspected this issue is associated to the delete[] operation, but commenting it out shows no effect.
The MyString constructor which is called is the following:
Looks like you are creating the temporary just fine. The problem might be in your copy constructor. Can you post that for us? (if you have a move constructor, can you post that as well?)