It leads to undefined behavior. I put a bit of work into explaining why. :) But that's a more technical answer.
Basically, undefined behavior means you are no longer guaranteed anything about the execution of the program; C++ simply has nothing to say. It could work exactly how you want, or it could crash miserably, or it could do both randomly.
So appearing to work is a perfectly fine result of undefined behavior, which is what you're seeing. The practical reason why is, on your implementation (and in honestly, every implementation), the this
pointer (the address of the instance being invoked) isn't being used at all in your function. That said, if you tried to use the this
pointer (for example by accessing a member variable), you'd likely crash.
Remember, the above paragraph is something specific to your implementation and it's current behavior. It's just a guess and something you can't rely on.