Compile the following program with dmd '-debug' switch: --- import std.algorithm, std.container; void main() { static bool compare(P a, P b) { return a.curColumn < b.curColumn; } Array!P a = make!(Array!P); sort!compare(a[]); } struct P { int curColumn = 0; } --- To get: --- /usr/include/dmd/phobos/std/range/package.d(7245,24): Error: 'std.range.SortedRange!(RangeT!(Array!(P)), compare).SortedRange.dbgVerifySorted' is not nothrow /usr/include/dmd/phobos/std/algorithm/sorting.d(1027,29): Error: template instance std.range.assumeSorted!(compare, RangeT!(Array!(P))) error instantiating /tmp/temp_7F0849317830.d(10,17): instantiated from here: sort!(compare, cast(SwapStrategy)0, RangeT!(Array!(P))) --- while without '-debug' the program can be compiled
Works in 2.067.1, fails in 2.068.0 and beyond.
Introduced in https://github.com/D-Programming-Language/dmd/pull/4845
Adding 'nothrow' compare does make it compile.
I don't quite see how this is related to the #4845 PR. Didn't we enable attribute inference for nested functions at some point? Why would assumeSorted even insist on the predicate to be nothrow? Seems like sth. with attribute inference is wrong here, we already hit plenty of issues with dbgVerifySorted.
I can't reproduce this, so I am assuming it has been fixed on the road. Please reopen, if this is still an issue for you.
Fixed by https://github.com/dlang/dmd/pull/5881.
Just curious, how does such a fix get put into the changelog? Or does it not make it in?
> ust curious, how does such a fix get put into the changelog? Or does it not make it in? https://github.com/dlang-bots/dlang-bot#automated-references For every release the changed.d script aggregates all commits of all six dlang repos (dmd,druntime,phobos,tools,dlang.org,installer) and searches for the Bugzilla Issue regex. Hence, it's important to link issues with the Dlang-Bot. Moreover, since 2.073 the changed.d also aggregates all *.dd files in the /changelog folders of the dlang repos. Btw since 2.074.0 we automatically generate the pending changelog, e.g. https://dlang.org/changelog/2.075.0_pre.html [1] https://github.com/dlang/tools/blob/master/changed.d
So I'm inferring from your answer, this won't get in the changelog. Because technically, this should be in the changelog on an older release of D. It was fixed at some point, inadvertently, but the bug was not closed at that time. Is there any recourse for updating an old changelog? We can just add it manually to an older version right?
> So I'm inferring from your answer, this won't get in the changelog. Yes. > We can just add it manually to an older version right? Yes -> https://github.com/dlang/dlang.org/blob/master/changelog/2.072.0.dd