This can be done, but as far as I know, this is not the case for compilers. The trouble is that users can define as many types as they like, and equality in any way they like, but with heap distribution, etc. It is very, very difficult to prove. In principle, this can be done, but only if your function is connected with direct numerical calculation, which is rare, and therefore, it usually does not have high value.
Puppy source
share