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


Steven Schveighoffer <schvei...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schvei...@yahoo.com


--- Comment #2 from Steven Schveighoffer <schvei...@yahoo.com> 2010-07-26 
06:20:03 PDT ---
I think the message is actually accurate.  I'll split out the relevant parts:

testbug.d(11): Error: function

testbug.Foo.getX ()          is not callable using argument types 
                 () const

What's happening is, the hidden this parameter is passed as const since the
object is const, but getX doesn't accept a const Foo.

It's the same as if you had a function like this:

void foo(Foo x)

foo(f);

Since f is const, and foo(Foo) must accept a mutable foo.

However, most people see the "const" applying to the function, which is a
common misconception.

I think a better error message might look like this:

Error: function constobj.Foo.getX () cannot be called using a const Foo.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to