[Issue 6858] New: opDispatch is unusable for property functions
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Oct 26 21:05:11 PDT 2011
    
    
  
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 at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-10-26 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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list