https://issues.dlang.org/show_bug.cgi?id=22769

          Issue ID: 22769
           Summary: `fun()` where fun is a property which returns an
                    object with opCall should call opCall
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: dlang-bugzi...@thecybershadow.net

///////////////// test.d ////////////////
bool called;

struct S
{
    void opCall()
    {
        called = true;
    }
}

@property S fun()
{
    return S.init;
}

static assert(is(typeof(fun()) == void));
/////////////////////////////////////////

With @property, the () should be applied to the property return value.

To avoid suddenly breaking code, we can first deprecate and then hard-error on
expressions which are "ambiguous" in this way.

--

Reply via email to