Introduce if condition for auto statement (only if static), adapt tests