[Mono-list] Const weirdness, revisited...

Mario Sopena Mario Sopena <mario.sopena@gmail.com>
Sat, 19 Feb 2005 13:56:14 +0100


Hello,

> My question being, however: when I initialize a const int to a certain
> int value, and later on reassign it, Mono merrily tells me that
> compilation succeeded. Like so:
> 
> const int meh = 5;
> meh = 10;

I have tested with mono 1.0.5 and it compiles, but, at runtime, the
line meh=10 doesn't make anything (you can test it yourself adding
Console.WriteLine), the value of meh doesn't change.

But, the Microsoft compiler argues by saying:
"error CS0131: The left-hand side of an assignment must be a variable,
property or indexer"
on the line meh=10. 

I haven't tested with the brand new 1.1.4, but in the case it
compiles, although it doesn't seems to have a real effect in the
executed code, shouldn't we fill a bug?

Mario