www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dbgVerifySorted is not nothrow

reply Panke <tobias pankrath.net> writes:
I've updated my compiler and ran into this regression:

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

Code:

---
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;
}
---

Result:
/usr/include/dlang/dmd/std/algorithm/sorting.d(982): Error: 
template instance std.range.assumeSorted!(compare, 
RangeT!(Array!(P))) error instantiating
tmp.d(10):        instantiated from here: sort!(compare, 
cast(SwapStrategy)0, RangeT!(Array!(P)))
1 tobias akela ~ [i] % dmd -debug tmp.d
/usr/include/dlang/dmd/std/range/package.d(7189): Error: 
'std.range.SortedRange!(RangeT!(Array!(P)), 
compare).SortedRange.dbgVerifySorted' is not nothrow
/usr/include/dlang/dmd/std/algorithm/sorting.d(982): Error: 
template instance std.range.assumeSorted!(compare, 
RangeT!(Array!(P))) error instantiating
tmp.d(10):        instantiated from here: sort!(compare, 
cast(SwapStrategy)0, RangeT!(Array!(P)))

What I don't understand is, why dbgVerifySorted has to be nothrow 
in the first place. Is that an new requirement for contracts? I 
couldn't find any hint in the language spec.
Nov 08 2015
parent BBaz <bb.temp gmx.com> writes:
On Sunday, 8 November 2015 at 08:05:41 UTC, Panke wrote:
 I've updated my compiler and ran into this regression:

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

 [...]
reopened.
Nov 08 2015