for scope & SP1

Using SP1 the following code does not compile (it used without)

#include <iostream>
#include <vector>

using namespace std;

void main()
{
for (int j=0; j<10; ++j)
cout << j;
cout << j << endl;
vector<double> vd;
for (vector<double>::iterator i=vd.begin(); i!=vd.end();++i)
cout << *i;
cout << *i;
}

Compilation breaks at the last line with
error C2065: 'i' : undeclared identifier

It is of course compiled with /Zc:forScope-, the first for (j) does not break !!!

Hope I haven't made a stupid mistake, regards,

Sylvain Bougnoux



Answer this question

for scope & SP1

  • Seraphino

    There have been several similar reportings at the C++ Language forum, at least one of which have been passed onto http://connect.microsoft.com/VisualStudio.

    You should head over there and do some searches -- you may very well find this exact issue recorded. Otherwise, report it and paste the URL back here.



  • for scope & SP1