digitalmars.D.bugs - [Issue 1730] New: const struct member func return invariant string can't assign to invariant string
- d-bugmail puremagic.com (29/29) Dec 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- Janice Caron (12/22) Dec 13 2007 That's correct behaviour, surely?
- d-bugmail puremagic.com (13/13) Dec 15 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (20/20) Nov 20 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (20/20) Mar 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (10/10) Dec 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (10/10) Dec 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (11/11) Dec 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (11/11) Dec 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (6/6) Dec 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (6/6) Dec 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (13/13) Jan 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=1730
- d-bugmail puremagic.com (9/9) Jan 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=1730
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Summary: const struct member func return invariant string can't assign to invariant string Product: D Version: 2.008 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: davidl 126.com struct mystruct{ invariant(char)[] toChars() { return "asdf"; } } void func(in mystruct s) { invariant(char)[] k=s.toChars; } testconst.d(9): function testconst.mystruct.toChars () does not match parameter types () testconst.d(9): Error: s.toChars can only be called on a mutable object, not const(mystruct) --
Dec 13 2007
On 12/14/07, d-bugmail puremagic.com <d-bugmail puremagic.com> wrote:struct mystruct{ invariant(char)[] toChars() { return "asdf"; } } void func(in mystruct s) { invariant(char)[] k=s.toChars; }That's correct behaviour, surely? Change the function definition to const invariant(char)[] toChars() { return "asdf"; } and the problem should go away. toChars() as written is incorrectly declared. It does not modify this, therefore it should be declared const. That said, I don't understant how s got to be const in the first place! Does "in" make things const?
Dec 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1730 davidl 126.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |minor Keywords|rejects-valid | Summary|const struct member func |error message enhance? |return invariant string | |can't assign to invariant | |string | But at least the first error message is confusing. --
Dec 15 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Probably part of the same bug: ---------- class Class { void fn1() const { fn2(); } void fn2() {} } ---------- const_call.d(3): Error: function const_call.Class.fn2 () is not callable using argument types () const ---------- This may make sense at the internal level, as trying to convert the 'this' argument implicitly from const(Class) to Class. But as a user error message, it's confusing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 20 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Michal Spadlinski <gim913 gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gim913 gmail.com PST --- I has similar problem with: struct Foo { bool boo() { return false; } int foo () const { assert (boo); return 66; } } this message is totally misleading -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason.james.house gmail.com 13:45:29 PST --- *** Issue 3642 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mrmocool gmx.de 13:45:34 PST --- *** Issue 4497 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 13:47:23 PST --- There's a ton of duplicate reports on this diagnostic. We better come up with a better error message than what we have now because there's a lot of complaints. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull AssignedTo|nobody puremagic.com |andrej.mitrovich gmail.com 06:31:46 PST --- https://github.com/D-Programming-Language/dmd/pull/1407 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1730 17:43:17 PST --- *** Issue 6707 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1730 17:50:19 PST --- *** Issue 6981 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/80d12f303c6184c9423a08b6d984db469ec27927 Fix Issue 1730 - Error message on 'this' reference modifier mismatch when calling methods is uninformative https://github.com/D-Programming-Language/dmd/commit/99e93a62383a627497d7eafbee772b99329cb70f Issue 1730 - Error message on 'this' reference modifier mismatch is uninformative -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 02 2013
http://d.puremagic.com/issues/show_bug.cgi?id=1730 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2013