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

           Summary: -property switch and opDispatch for methods and
                    properties
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: johnch_a...@hotmail.com


--- Comment #0 from johnch_a...@hotmail.com 2012-11-02 02:14:39 PDT ---
When the -property compiler switch is in effect, opDispatch cannot be used for
both methods and properties.

Currently, we can just omit the switch and things work fine. But if the
behaviour of the switch becomes the norm, this issue will have to be addressed.

struct Demo {
  @property auto opDispatch(string name, A...)(auto ref A args) {}
}

void main() {
  Demo d;
  d.test(1);     // method call OK
  d.test(1,2);   // ditto
  d.test = 4;    // property setter OK
  d.test(1,2,3); // error, properties can only have zero, one, or two parameter
}

If you omit the @property attribute from the opDispatch definition, the
compiler complains 'not a property d.opDispatch!("test")'.

Perhaps the simplest fix would be for opDispatch to be excluded from any
property rules altogether.

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

Reply via email to