Use detect_mismatch pragma when possible (refs #10404 in track)