www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19645] New: Default parameters not checked for safe

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

          Issue ID: 19645
           Summary: Default parameters not checked for  safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

Reported by ag0aep6g:

import std.stdio;

 safe:

immutable x = 42;

void main()
{
    *f() = 7;
    writeln(x); // 42
    writeln(*&x); // 7
}

int* f(int* y = cast(int*) &x) { return y; }

--
Feb 03 2019