www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6858] New: opDispatch is unusable for property functions

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

           Summary: opDispatch is unusable for property functions
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



21:04:04 PDT ---
struct Foo
{
     property void x(int) {}
}

struct Bar
{
    Foo foo;

    void opDispatch(string Field, Args...)(Args args)
    {
        foo.x = args;
    }
}

void main()
{
    Bar bar;
    bar.x = 5;
}

Error: expected 1 function arguments, not 0

Of course there's no way DMD can tell in advance that opDispatch will invoke a
property function, so it just expects opDispatch to return an lvalue to be
assigned with 5. :/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2011