Bug 14106 – sort is @safe in release mode, @system in debug mode

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-01T23:09:00Z
Last change time
2015-02-18T03:41:58Z
Keywords
pull
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2015-02-01T23:09:06Z
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.
Comment #1 by andrei — 2015-02-01T23:11:34Z
Comment #2 by code — 2015-02-02T15:59:43Z
Comment #3 by github-bugzilla — 2015-02-02T22:11:59Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/06fd47ffec0124dbcb4bbadea467492e9b65095b fix Issue 14106 - sort is unsafe in debug mode - need attribute inference to toString delegate https://github.com/D-Programming-Language/phobos/commit/3395af48ff11df7f5ba9dd1f325cf3a21d7c317c Merge pull request #2952 from MartinNowak/fix14106 fix Issue 14106 - sort is unsafe in debug mode
Comment #4 by github-bugzilla — 2015-02-18T03:41:58Z