D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15304 - [REG 2.068.0] Error about SortedRange not being nothrow in debug mode
Summary: [REG 2.068.0] Error about SortedRange not being nothrow in debug mode
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2015-11-09 00:29 UTC by basile-z
Modified: 2017-07-07 12:42 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description basile-z 2015-11-09 00:29:07 UTC
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
Comment 1 Steven Schveighoffer 2015-11-09 15:23:14 UTC
Works in 2.067.1, fails in 2.068.0 and beyond.
Comment 2 Jack Stouffer 2015-12-03 21:09:33 UTC
Introduced in https://github.com/D-Programming-Language/dmd/pull/4845
Comment 3 Walter Bright 2016-03-19 10:07:47 UTC
Adding 'nothrow' compare does make it compile.
Comment 4 Martin Nowak 2016-03-26 22:18:28 UTC
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.
Comment 5 Seb 2017-07-05 18:17:05 UTC
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.
Comment 6 Vladimir Panteleev 2017-07-07 05:54:04 UTC
Fixed by https://github.com/dlang/dmd/pull/5881.
Comment 7 Steven Schveighoffer 2017-07-07 12:12:13 UTC
Just curious, how does such a fix get put into the changelog? Or does it not make it in?
Comment 8 Seb 2017-07-07 12:19:26 UTC
> 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
Comment 9 Steven Schveighoffer 2017-07-07 12:36:49 UTC
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?
Comment 10 Seb 2017-07-07 12:42:58 UTC
> 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