digitalmars.D.bugs - [Issue 2933] New: Cannot return const/immutable with contracts (out/invariant) enabled
- d-bugmail puremagic.com (39/39) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2933
- d-bugmail puremagic.com (8/8) May 10 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2933
- d-bugmail puremagic.com (10/10) Jun 04 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2933
- d-bugmail puremagic.com (10/10) Jun 10 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2933
- d-bugmail puremagic.com (11/11) May 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2933
- d-bugmail puremagic.com (11/11) Jun 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2933
http://d.puremagic.com/issues/show_bug.cgi?id=2933
Summary: Cannot return const/immutable with contracts
(out/invariant) enabled
Product: D
Version: 2.029
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: tekjig gmail.com
If a method of a class returns a const or immutable value, and
the class has class invariant, then the compile fails. It also
fails if a method returning a const/immutable has an out contract.
The following code:
--------------------
class Foo
{
invariant() {}
const(int) foo()
{
return 0;
}
immutable(int) bar()
out(abc) { }
body
{
return 0;
}
}
--------------------
causes this compile error:
--------------------
test.d(4): Error: variable test.Foo.foo.__result cannot modify const
test.d(9): Error: variable test.Foo.bar.abc cannot modify mutable
--------------------
--
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2933 --- Created an attachment (id=356) --> (http://d.puremagic.com/issues/attachment.cgi?id=356) This patch should fix the problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 10 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2933
Sobirari Muhomori <maxmo pochta.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |baryluk smp.if.uj.edu.pl
PDT ---
*** Issue 3048 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: -------
Jun 04 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2933
Sobirari Muhomori <maxmo pochta.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrei metalanguage.com
PDT ---
*** Issue 2799 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: -------
Jun 10 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2933
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug yahoo.com.au
On svn 484(DMD 2.046), this patch doesn't fix the test case. It's possible that
the patch will work once bug 3667 is fixed, but I haven't tested that.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2933
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Fixed when bug 3667 was fixed, in svn 490 (DMD 2.047).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 05 2010









d-bugmail puremagic.com 