On 11/27/2012 1:36 AM, jerro wrote:
That doesn't work, immutable breaks that test.

You're right. I didn't expect that. It seems that this compiles:

void foo()
{
     immutable a = 1;
     enum b = a;
}

But this doesn't, obviously:

void foo(immutable int a)
{
     enum b = a;
}

I wonder, is this considered a bug? It seems very inconsistent to me.

It's not a bug. In the latter case, b is a manifest constant, and its value cannot be determined at compile time. Hence, it will not compile.

Reply via email to