fix mismatch of the scope push/pop paring
[Refactoring] Replace new Scope(*sc) to sc->copy()
fix Issue 11777 - [ICE] dmd memory corruption as `Scope::pop` `free`s `fieldinit` used also in `enclosing`
Merge pull request #3423 from 9rnsr/fix11777

[REG2.065] Issue 11777 - [ICE] dmd memory corruption as `Scope::pop` `free`s `fieldinit` used also in `enclosing`
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.
Merge pull request #3424 from MartinNowak/fix12523

fix Issue 12523 - wrong type deduced for foreach ref argument