This is because you (inadvertently) use the comma operator, whose value is that of the last expression included. You can list as many expressions as you like, separated by the comma operator, the result is always that of the last expression. This is not related to return
; your code can be rewritten like
int tmp = (x, y); // x = 7, y = 12 -> tmp is assigned 12
return tmp;
[Updated] You don't usually need brackets around the list, but here you do, due to the assignment operator having a higher precedence than comma - kudos to @Draco for pointing it out.