Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 24, 2010 [Issue 4497] New: inexpressive error message for const object method | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4497 Summary: inexpressive error message for const object method Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: mrmocool@gmx.de --- Comment #0 from Trass3r <mrmocool@gmx.de> 2010-07-23 18:16:17 PDT --- class Foo { void getX() {} } const Foo f; void main() { f.getX(); } Error: function constobj.Foo.getX () is not callable using argument types () const This error message could be more expressive to show that getX must be marked as const to make it work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 24, 2010 [Issue 4497] inexpressive error message for const object method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=4497 --- Comment #1 from Trass3r <mrmocool@gmx.de> 2010-07-24 04:39:33 PDT --- Note that this is also true for objects passed to a function as "const Class object" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 26, 2010 [Issue 4497] inexpressive error message for const object method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=4497 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schveiguy@yahoo.com --- Comment #2 from Steven Schveighoffer <schveiguy@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: ------- |
August 03, 2010 [Issue 4497] inexpressive error message for const object method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=4497 --- Comment #3 from Trass3r <mrmocool@gmx.de> 2010-08-03 06:01:11 PDT --- I'm pretty sure I also had similar errors without the indicating "const" at the end of the message. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 23, 2012 [Issue 4497] inexpressive error message for const object method | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=4497 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich@gmail.com Resolution| |DUPLICATE --- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-23 13:45:34 PST --- *** This issue has been marked as a duplicate of issue 1730 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation