Bug 4132 – pointer arithmetic accepted in @safe functions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-04-28T09:21:00Z
Last change time
2014-02-15T02:46:11Z
Keywords
accepts-invalid, patch
Assigned to
nobody
Creator
rayerd.wiz
Comments
Comment #0 by rayerd.wiz — 2010-04-28T09:21:00Z
void main() @safe
{
int a;
int* p = &a;
p++;
}
This code is able to compile.
* References [http://www.digitalmars.com/d/2.0/function.html]
- Safe Functions
Safe functions are marked with the @safe attribute.
The following operations are not allowed in safe functions:
- No casting from a pointer type to any type other than void*.
- No casting from any non-pointer type to a pointer type.
- No modification of pointer values. <-------------------------------- here!