September 05, 2011 [Issue 6604] New: Casting away immutable modifier does nothing | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6604 Summary: Casting away immutable modifier does nothing Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: rofflwaffls@gmail.com --- Comment #0 from Tony Young <rofflwaffls@gmail.com> 2011-09-05 06:52:33 PDT --- Created an attachment (id=1021) Test case. DMD2 cannot cast away the immutable modifier a variable, or raise a suitable error for it. Attached code outputs: 0 0 0 2 Where the following is expected: 0 2 0 2 ... or some kind of error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 05, 2011 [Issue 6604] Casting away immutable modifier does nothing | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tony Young | http://d.puremagic.com/issues/show_bug.cgi?id=6604 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |thecybershadow@gmail.com Resolution| |INVALID --- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> 2011-09-05 07:11:12 PDT --- Casting is the tool which allows you to break D's typesystem. This behavior is completely expected and is by design. If you use a cast, it's expected that you know what you're doing. Note that your code will not compile with @safe: test.d(5): Error: cast from const(int*) to int* not allowed in safe code -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation