For every pattern that refers to a static value, evaluate it and emit a warning if it is a NaN. Fixes #6804