[Issue 3814] New: Mutation of immutable string
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 18 09:51:04 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3814
Summary: Mutation of immutable string
Product: D
Version: 2.040
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: sean at invisibleduck.org
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2010-02-18 09:51:03 PST ---
import std.stdio: writeln;
void main() {
string s = "ab";
s.length += 1;
//writeln(typeid(typeof(s))); // Prints:
s[2] = 'a'; // test5.d(6): Error: s[2] isn't mutable
}
Why is length+=1 allowed if s is immutable?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list