Warn about casting an enum variant function

Closes #18154.
Could you give a more descriptive message please? (It is not clear why this is bad, or what is actually the source of the error - that is, is casting enum variants always bad, and we're being informative telling the user it is a function, or are we casting the function rather than the result of the function, etc.).

Also, nit, the third arg should be aligned with the 1st arg, not be tab indented