MSVC has a non-standard extension (/Ze /Zc:forScope) that allows variables declared in for-loops to remain in the "outer" scope: http://msdn.microsoft.com/en-us/library/bk5hc10s.aspx. When the same variable is re-declared after the for-loop, the compiler issues warning C4288. There's also a bug in VS2005 that enables this extension even if the /Zc:forScope option wasn't specified: http://connect.microsoft.com/VisualStudio/feedback/details/338010/bogus-compiler-warning-c4288. Looks like we got hit by that bug, so we need to disable that warning.
Created attachment 60785 [details] patch
Comment on attachment 60785 [details] patch > + MSVC has a non-standard extension (/Ze /Zc:forScope-) that allows > + variables declared in for-loops to remain visible in the same > + scope even after the for-loop > + (http://msdn.microsoft.com/en-us/library/bk5hc10s.aspx). When this > + extension is enabled, re-declaring the same variable in that scope > + results in a C4288 warning. > + > + At the same time, there seems to be a bug in VS2005 that > + erroneously enables /Zc:forScope- even when that option is not > + specified > + (http://connect.microsoft.com/VisualStudio/feedback/details/338010/bogus-compiler-warning-c4288). This makes it sound like the actual behavior gets enabled, not just the warning. Explaining in the previous paragraph that /Ze turns on the behavior and /Zc:forScope- turns on the warning could clear this up, as could changing the description in this paragraph. Other than that, r=me
(In reply to comment #2) > (From update of attachment 60785 [details]) > > + MSVC has a non-standard extension (/Ze /Zc:forScope-) that allows > > + variables declared in for-loops to remain visible in the same > > + scope even after the for-loop > > + (http://msdn.microsoft.com/en-us/library/bk5hc10s.aspx). When this > > + extension is enabled, re-declaring the same variable in that scope > > + results in a C4288 warning. > > + > > + At the same time, there seems to be a bug in VS2005 that > > + erroneously enables /Zc:forScope- even when that option is not > > + specified > > + (http://connect.microsoft.com/VisualStudio/feedback/details/338010/bogus-compiler-warning-c4288). > > This makes it sound like the actual behavior gets enabled, not just the warning. Explaining in the previous paragraph that /Ze turns on the behavior and /Zc:forScope- turns on the warning could clear this up, as could changing the description in this paragraph. done. made it more clear that /Ze enables all MSVC extensions and /Zc:forScope- tells the compiler to issue a warning when it sees the same variable declared in a for-loop and then re-declared in the same scope.
landed: r62708.