Given that n is an integer, and the constant 0.5, it should be possible to infer that the n+0.5 isn’t an integer. I wonder this simplification isn’t carried out here, although the compiler does propagate constants if n is a known at compile-time as well?

There are some corner cases where the value of isinteger can be predicted, but it’s a pretty tricky interaction between the eps(x) graph for the float type, the range of the integer type, and the specific float constant that’s being added. Let’s say we have this function:

and we say F = typeof(x) and T = typeof(n). When could we constant fold based on the value of x? It’s a pretty complex set of rules that LLVM doesn’t know.

This is type-piracy, which I’m assuming isn’t happening. In any case, the point not about methods being overwritten, it’s about the method as defined in Base not being able to infer the result. I’m not talking about a general case where I don’t know the method that’s called, given the arguments.

Sorry, you’re right; even with my type piracy, the types are inferred and constants propagated. My input unfortunately degraded the conversation’s SNR.