Bug 8552 – Bogus diagnostic when member function call doesn't match constancy

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-15T10:56:00Z
Last change time
2013-01-07T07:10:36Z
Keywords
diagnostic
Assigned to
nobody
Creator
dmitry.olsh

Comments

Comment #0 by dmitry.olsh — 2012-08-15T10:56:08Z
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.
Comment #1 by bearophile_hugs — 2012-08-15T11:03:07Z
See Issue 8549 (But maybe both are dupes of an older bug report of mine)
Comment #2 by hsteoh — 2013-01-03T20:52:25Z
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
Comment #3 by k.hara.pg — 2013-01-07T07:10:36Z
(In reply to comment #2) > 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 ***