In Visual Studio 2013, I wrote the following in an empty, brand-new command-line solution:
int main(int argc, char* argv[])
{
int xs[1];
for (auto x : xs)
do
;
while (0);
return 0;
}
When I compile, I get the following error:
error C2059: syntax error : '}'
on the line containing the single semicolon. Have I found a compiler bug? Or is the range-based for loop subtle beyond my comprehension?
for (auto x : xs) { do; } while(0);
? – Sinesfor (auto x : xs) { do; while(0);}
, otherwise it should be an error sincedo
by itself is not a valid keyword. He's got an empty statement within thedo ... while
. – Adachido ... while
statement; or replace the range-for with a regular oldfor
statement. You should file a bug report on connect.microsoft.com – Adachi