I was bored and came up with such hack (pseudocode):
1 struct proxy { 2 operator int(); // int function 3 operator double(); // double function 4
The issue is that if the function has two return types, it's probably doing two different (alternative) things . And to the extent possible, each function/method should do one coherent thing.