[Issue 1824] New: Object not const correct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 9 02:44:03 PST 2008


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

           Summary: Object not const correct
           Product: D
           Version: 2.010
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: caron800 at googlemail.com


Just thought I'd let you know that the following functions in Object are not
const correct in D2:

    void print();
    string toString();
    int opEquals(Object o);
    int opCmp(Object o);
    hash_t toHash();

They should be:

    const
    {
        void print();
        string toString();
        int opEquals(const(Object) o);
        int opCmp(const(Object) o);
        hash_t toHash();
    }

(And for that matter, opEquals should probably return bool, but that's less
important).

And just to make life really interesting, if you do

    class A
    {
        const
        {
            int opEquals(Object o) { /*...*/ }
        }
    }

You get the error message

function A.opEquals (Object) does not match parameter types (Object)


-- 



More information about the Digitalmars-d-bugs mailing list