fix Issue 12523 - wrong type deduced for foreach ref argument

- No need to change the storage class because the var type
  already has inferred modifiers.