digitalmars.D.bugs - [Issue 6604] New: Casting away immutable modifier does nothing
- d-bugmail puremagic.com (31/31) Sep 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6604
- d-bugmail puremagic.com (16/16) Sep 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6604
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
---
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: -------
Sep 05 2011
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
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: -------
Sep 05 2011








d-bugmail puremagic.com