www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8552] New: Bogus diagnostic when member function call doesn't match constancy

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8552

           Summary: Bogus diagnostic when member function call doesn't
                    match constancy
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com



10:56:08 PDT ---
It's an old and annoying bug. Could be a duplicate but I failed to find any.

Sample:

struct SimpleCaseEntry
{
    ubyte bucket;// n - number in bucket
     property ubyte size()
    {
        return bucket & 0x3F;
    }
     property auto isLower()
    {
        return bucket & 0x40;
    }
     property auto isUpper()
    {
        return bucket & 0x80;
    }
    this(ubyte size, bool lower, bool upper)
    {
        bucket = size;
        if(lower)
            bucket |= 0x40;
        if(upper)
            bucket |= 0x80;

    }
}

void main()
{
    const SimpleCaseEntry e = SimpleCaseEntry(8, true, false);
    assert(!e.isUpper);
    assert(e.isLower);
}

With dmd 2.060:

D:\D\m.d(30): Error: function m.SimpleCaseEntry.isUpper () is not callable
using argument types()
D:\D\m.d(31): Error: function m.SimpleCaseEntry.isLower () is not callable
using argument types ()

Not a single word mentioning CONST or QUALIFIERS. While I'm more or less used
to wrong error message it would blow away newibie's mind and thus marked as
major.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8552


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



See Issue 8549

(But maybe both are dupes of an older bug report of mine)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8552


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |hsteoh quickfur.ath.cx
         Resolution|                            |FIXED



Seems fixed in latest git head:

$ dmd test.d
test.d(30): Error: mutable method test.SimpleCaseEntry.isUpper is not callable
using a const object
test.d(31): Error: mutable method test.SimpleCaseEntry.isLower is not callable
using a const object

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 03 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8552


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE




 Seems fixed in latest git head:
 
 $ dmd test.d
 test.d(30): Error: mutable method test.SimpleCaseEntry.isUpper is not callable
 using a const object
 test.d(31): Error: mutable method test.SimpleCaseEntry.isLower is not callable
 using a const object
The lack of information about qualifier mismatching is fixed by bug 6707. After that, the error message is improved by fixing bug 1730. Both are fixed in 2.061. *** This issue has been marked as a duplicate of issue 6707 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 07 2013