www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22769] New: `fun()` where fun is a property which returns an


          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: nobody puremagic.com
          Reporter: dlang-bugzilla 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.

Feb 13 2022