[Issue 7609] New: Can't access field of aliased type via 'with' statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 29 05:52:38 PST 2012


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

           Summary: Can't access field of aliased type via 'with'
                    statement
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-02-29 05:52:37 PST ---
import std.stdio;

struct Foo
{
    int x;
}

struct Bar
{
    Foo foo;
    alias foo this;
}

void main()
{
    Bar bar;

    writeln(bar.x);  // ok

    with (bar) {
        writeln(x);  // fail
    }
}

test2.d(23): Error: undefined identifier x

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