I've been trying to track down why the Microsoft C# compiler fails to compile the following program:
class T { int decl; // of a field void Method() { decl++; { int decl; // of a local variable } } } The closest I can get is 14.5.2.1 Invariant meaning in blocks, which states "For each occurence of a simple-name in an expression, every other occurence of the same identifier as a simple-name in an expression within the immediately enclosing block or switch-block must refer to the same entity." However, I don't think the program violates this constraint because the second occurence of decl is not in an expression (its in a declarator). Have I missed something or is the compiler being a tad over zealous? Thanks Jon Jagger You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.