[Issue 5084] New: Static code does not ignore instance names during name lookup
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 20 03:54:11 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5084
Summary: Static code does not ignore instance names during name
lookup
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: ah08010-d at yahoo.com
--- Comment #0 from Austin Hastings <ah08010-d at yahoo.com> 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
case,
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list