On Fri, 17 May 2002 09:24:48 -0700, Jim Arnold <[EMAIL PROTECTED]>
wrote:

>Ah, then how about Section 10.3, paragraph 3, items 18 and 19?
>
>18 The local variable declaration space of a block includes any nested
>blocks.
>19 Thus, within a nested block it is not possible to declare a local
>variable with the same name as a local variable in an enclosing block.

Yeah at first I thought that would be it too. But on closer inspection the
outer declaration is not in a block and its not a local variable
declaration either - its a field declaration.

If you remove the _use_ from the fragment then it compiles ok (as 10.7
para 1 sentence 1 says it should).

class T
{
    int decl; // of a field

    void Method()
    {
        // decl++;

        {
            int decl; // of a local variable
        }
    }
}

It's the appearance of decl as a simple-name in an expression that seems
to cause the compiler error.

Cheers
JJ

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to