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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from [email protected] 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: -------