[Issue 8162] New: [TDPL] -property fails to give an error when a property function is called with parens

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 29 22:43:08 PDT 2012


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

           Summary: [TDPL] -property fails to give an error when a
                    property function is called with parens
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-05-29 22:44:59 PDT ---
This code

struct R42
{
    @property int front() @safe const pure nothrow
    {
        return 42;
    }


    @property bool empty() @safe const pure nothrow
    {
        return false;
    }

    void popFront() @safe pure nothrow
    {
    }
}

void main()
{
    R42 r;
    auto e = r.empty();
}


shouldn't compile, since empty is a property and therefore must not compile
with parens per strict property enforcement as described in TDPL. _Not_ calling
popFront with parens _does_ result in an error with -property, but calling
either of the property functions _with_ parens doesn't. So -property seems to
be doing half of its job but not all of it. With -property, @property functions
should never be callable with parens, and non- at property functions should never
be callable without them.

-- 
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