+++ This bug was initially created as a clone of Bug #97357 +++
Fixing -Wshadow warnings results in patches that are a bit of a pain to review, so I've broken this out from Bug #97357.
The initial thing to review is Attachment #127066 [details].
Thomas's patch looks good. If Travis-CI says yes, I'm going to apply it, apart from the bit that depends on Bug #97357 (actually enabling the warning).
Fixed in git for 1.11.8, thanks.