This is not a bug - although for() is a well-known construct it still
requires run-time evaluation to test the entry to the loop. On the other
hand this:
static double GetValue()
{
for(;true;)
{
return 10d;
}
}
is compile-time deterministic and does compile.
Richard
--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Niall" <as**@me.com> wrote in message
news:ej**************@TK2MSFTNGP12.phx.gbl...
I was compiling the function below and received this error. Putting a
return statement after the loop solves the problem I believe this is a compiler
bug, as this code will always leave the function within the loop.
protected DateTime GetDate()
{
for (int i = 0; i < 3; i++)
{
try
{
return DateTime.Now;
}
catch
{
throw;
}
}
}
Niall