I'm working on some legacy code and I ran into something that I'm not sure is safe - in fact I'm pretty sure it's undefined, but I'm not entirely sure why (more or less a bad feeling).
For some reason this code has a class, we'll call it A. Class A has an overloaded pre-increment operator (++) that appears to do some operations on the value of a pointer contained within it (we'll call that pointer B).
I found a function call where the user passes in A, and a de-referenced copy of pointer B while using the pre-increment operator that's been overloaded.
foo(++A, *B);
Since A's pre-increment modifies the value pointed to by B, and B is dereferenced and used as a parameter in the same call... is there a problem or should I just leave it this way?
Sorry if this sounds confusing - the code is way too complex to paste in but I did my best to explain the situation. If needed, I'll make some fake code representing the situation but I'm hoping its clear.
Also, I'm aware that it's bad design for this code to pass in a parameter already contained in A separately, but I wanted to understand if there was an actual problem aside from that.