[Issue 4545] New: Alias to members possible without "this" instance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 1 07:56:11 PDT 2010


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

           Summary: Alias to members possible without "this" instance
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomeksowi at gmail.com


--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2010-08-01 07:56:10 PDT ---
I'm tearing up bug 4533 to have member-related alias problems in a separate
bug.

You can alias members from *outside*:

class A {
    void foo() {}
}

alias A.foo goo;

This compiles. It fails only if goo is called but should fail already at the
alias declaration.


Also, Andrej Mitrovic found a similar issue documented, but not implemented:

In the docs (http://www.digitalmars.com/d/2.0/declaration.html), there's this
code:

void main() {
    struct S { static int i; }
    S s;

    alias s.i a;    // illegal, s.i is an expression
    alias S.i b;    // ok
    b = 4;        // sets S.i to 4
}

But this [illegal expression] will compile.

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