[Issue 19646] New: Initialization of globals not checked for @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 4 01:38:40 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19646

          Issue ID: 19646
           Summary: Initialization of globals not checked for @safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

Reported by Luís Marques:

import std.stdio;

@safe:

const x = 42;
int* y = cast(int*) &x;

void main()
{
    *y = 7;
    writeln(x); // prints 42
}

--


More information about the Digitalmars-d-bugs mailing list