[Issue 15304] New: Error about SortedRange not being nothrow in debug mode

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Nov 8 16:29:07 PST 2015


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

          Issue ID: 15304
           Summary: Error about SortedRange not being nothrow in debug
                    mode
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: bb.temp at gmx.com

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

--


More information about the Digitalmars-d-bugs mailing list