[Issue 9630] DMD git: can't access array field properties from static method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 1 22:15:24 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9630



--- Comment #11 from Kenji Hara <k.hara.pg at gmail.com> 2013-03-01 22:15:23 PST ---
(In reply to comment #6)
> 2. In expr.aFieldVariable, if expr is just a variable that needs this, the
> "need this" error for aFieldVariable access is specially delayed.
> 
>   This is more specialized 'exception' than #1.
>   The chain of field access like following would be accepted by this.
> 
>   Type.field1.field2.field3.staticFieldOrFunction

Why it is explicitly allowed? The reason of rule #2 is "a variable access can
be regarded as a symbol access". For example, symbol access is already allowed
in template argument.

template X(alias symbol) {}
struct S {
    T field1;
    struct T { int field2; }
}
void main() {
    alias x = X!(S.field1.field2);     // access symbol S.T.field2
    auto y = S.field1.field2.offsetof; // access symbol S.T.field2
}

This is consistent behavior.

-- 
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