Summary: Static code does not ignore instance names during name
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Austin Hastings <> 2010-10-20 03:53:30 
PDT ---
In the code
module scratch;

import std.stdio;

int[ 3 ] x;

struct S {

    int[ 2 ] x;

    static void foo() {
        writeln( x[2] );

I would expect that the static method performed static name lookup. In this
that would resolve the x[] reference to the variable at module scope.

Instead, the reference is apparently resolved to the member, despite the member
being an illegal reference. If the [2], which generates an "index out of
bounds" error, is replaced with [1], then the compiler proceeds to issue a
"this required for reference to member" error.

Obviously, .x would work in this case, but I think this may be a general bug.
Alternatively, could someone provide a pointer to the rules for name lookup?

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to