digitalmars.D.bugs - [Issue 3311] New: std.range.chain shouldn't have opIndexAssign if arguments aren't mutable.
- d-bugmail puremagic.com (48/48) Sep 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3311
- d-bugmail puremagic.com (10/10) Sep 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3311
- d-bugmail puremagic.com (11/11) Dec 01 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3311
- d-bugmail puremagic.com (10/10) Dec 06 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3311
http://d.puremagic.com/issues/show_bug.cgi?id=3311 Summary: std.range.chain shouldn't have opIndexAssign if arguments aren't mutable. Product: D Version: 2.032 Platform: Other OS/Version: Windows Status: NEW Keywords: patch Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: dsimcha yahoo.com import std.range; void main() { immutable(uint)[] foo = [1,2,3,4,5]; immutable(uint)[] bar = [6,7,8,9,10]; auto baz = chain(foo, bar); } C:\dmd2\windows\bin\..\..\src\phobos\std\range.d(930): Error: this._input._field_field_0[index] isn't mutable C:\dmd2\windows\bin\..\..\src\phobos\std\range.d(930): Error: this._input._field_field_1[index] isn't mutable This is too simple to fix to do a formal patch, but here's an "inline patch": /**Tests whether a type is mutable, i.e. not const or immutable. This is only * tested at the shallowest level, not transitively. For example, an * immutable(uint)[] would be considered mutable.*/ template isMutable(T) { enum isMutable = !is(T == const(T)); } unittest { static assert(isMutable!(ElementType!(uint[]))); static assert(isMutable!(ElementType!(float[]))); static assert(!isMutable!(ElementType!(string))); static assert(isMutable!(ElementType!(string[]))); static assert(!isMutable!(ElementType!(const(char)[]))); static assert(isMutable!string); } And in std.range.chainImpl: static if (allSameType) void opIndexAssign(ElementType v, uint index) should be changed to static if (allSameType && isMutable!(ElementType)) void opIndexAssign(ElementType v, uint index) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3311 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3311 David Simcha <dsimcha yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Fixed SVN. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3311 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 00:50:58 PST --- Fixed dmd 2.037 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 06 2009