I do not like that it is asymmetric.
eg. what you really wanted was
if(typesEqual(t1, t2) == Yes) { do_something(); }
but by chance you wrote
if(typesEqual(t1, t2)) { do_something(); }
It seems strange / ugly that you can use the logical trick for No, but not for Yes.
I think I would solve this by renaming the function to tryCompareTypes(t1, t2) and changing your enum to
enum Result { Maybe, No, Yes };
So tryCompareTypes() returns 0 if "it was not possible" to finally decide whether the types are equal, otherwise it returns either "No" or "Yes", both of which are non-zero and, therefore, indicate "success".
source share