[Issue 7838] New: Give some error messages for wrong ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 5 17:54:44 PDT 2012


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

           Summary: Give some error messages for wrong ranges
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-04-05 17:55:22 PDT ---
I'd like DMD to give some error messages for wrong definitions of ranges, like
in this case:


struct Powers {
    int m;
    BigInt n;
    this(int m_) { this.m = m_; }
    const bool empty = false;
    BigInt front() { return n ^^ m; }
    void popFront() { n += 1; }
}


It looks correct, but it's wrong. ElementType!Powers is void.

The correct code (a @property was missing):

struct Powers {
    int m;
    BigInt n;
    this(int m_) { this.m = m_; }
    const bool empty = false;
    @property BigInt front() { return n ^^ m; }
    void popFront() { n += 1; }
}

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