This code is only sample of problem in my bigger code. In bigger code I'm trying to write getPosition function which retrieves position of a object and you can either retrieve vector (with 2 values) or enum Position. But I can write only one type of getPosition.
Two options I can think of off the top of my head:
I assume your enum Positions map to coordinates. Can you return the coordinates of the enum position instead of the enum value itself?
How is the calling function supposed to know if it will receive a vector or an enum value? Based on this knowlege, the calling function can decide between which of 2 functions to call: getPositionXY() and getPostionEnum().