[Issue 14106] New: sort is @safe in release mode, @system in debug mode

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 1 15:09:06 PST 2015


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

          Issue ID: 14106
           Summary: sort is @safe in release mode, @system in debug mode
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Repro:

@safe void main()
{
    import std.algorithm : sort;
    import std.range : zip;
    int[] a = [ 1, 2, 3 ];
    string[] b = [ "a", "b", "c" ];
    sort!((c, d) => c[0] > d[0])(zip(a, b));
    assert(a == [ 3, 2, 1 ]);
    assert(b == [ "c", "b", "a" ]);
}

Fails to compile with -debug, works otherwise.

--


More information about the Digitalmars-d-bugs mailing list